aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Uzunov <andrey.uzunov@gmail.com>2013-09-08 10:37:24 +0000
committerAndrey Uzunov <andrey.uzunov@gmail.com>2013-09-08 10:37:24 +0000
commit7c86ad3199ebe0b5cae1c7f5ce6c24821f470c4e (patch)
tree25763246c6f3b9e4b3b7d76bd44db7373abae879
parent921133b1a584dc203d1358c8fe769abd7cbf32af (diff)
downloadlibmicrohttpd-7c86ad3199ebe0b5cae1c7f5ce6c24821f470c4e.tar.gz
libmicrohttpd-7c86ad3199ebe0b5cae1c7f5ce6c24821f470c4e.zip
spdy: doc -- parameter description fixed
-rw-r--r--src/include/microspdy.h2
-rw-r--r--src/microspdy/daemon.h2
-rw-r--r--src/microspdy/internal.h4
-rw-r--r--src/microspdy/io.c8
-rw-r--r--src/microspdy/io.h13
-rw-r--r--src/microspdy/session.c32
-rw-r--r--src/microspdy/session.h18
7 files changed, 55 insertions, 24 deletions
diff --git a/src/include/microspdy.h b/src/include/microspdy.h
index a5714b2d..1e1e229e 100644
--- a/src/include/microspdy.h
+++ b/src/include/microspdy.h
@@ -807,7 +807,7 @@ typedef void
807 * and possibly other stuff needed by the lib. Currently the call 807 * and possibly other stuff needed by the lib. Currently the call
808 * always returns SPDY_YES. 808 * always returns SPDY_YES.
809 * 809 *
810 * @param enum SPDY_IO_SUBSYSTEM io_subsystem the IO subsystem that will 810 * @param io_subsystem the IO subsystem that will
811 * be initialized. Several can be used with bitwise OR. If no 811 * be initialized. Several can be used with bitwise OR. If no
812 * parameter is set, the default openssl subsystem will be used. 812 * parameter is set, the default openssl subsystem will be used.
813 * @return SPDY_YES if the library was correctly initialized and its 813 * @return SPDY_YES if the library was correctly initialized and its
diff --git a/src/microspdy/daemon.h b/src/microspdy/daemon.h
index 0dbc5ab1..1be6ce56 100644
--- a/src/microspdy/daemon.h
+++ b/src/microspdy/daemon.h
@@ -47,6 +47,8 @@ enum SPDY_IO_SUBSYSTEM spdyf_io_initialized;
47 * @param npdcb callback called when HTTP POST params are received 47 * @param npdcb callback called when HTTP POST params are received
48 * after request 48 * after request
49 * @param fnscb callback called when new stream is opened by a client 49 * @param fnscb callback called when new stream is opened by a client
50 * @param fndcb callback called when new data -- within a data frame --
51 * is received by the server
50 * @param cls extra argument to all of the callbacks without those 52 * @param cls extra argument to all of the callbacks without those
51 * specific only for the framing layer 53 * specific only for the framing layer
52 * @param fcls extra argument to all of the callbacks, specific only for 54 * @param fcls extra argument to all of the callbacks, specific only for
diff --git a/src/microspdy/internal.h b/src/microspdy/internal.h
index 72dfd3ec..7876c785 100644
--- a/src/microspdy/internal.h
+++ b/src/microspdy/internal.h
@@ -73,10 +73,10 @@ extern void *spdyf_panic_cls;
73/** 73/**
74 * Asserts the validity of an expression. 74 * Asserts the validity of an expression.
75 * 75 *
76 * @param expression (bool) 76 * @param expr (bool)
77 * @param msg message to print on error (const char *) 77 * @param msg message to print on error (const char *)
78 */ 78 */
79#define SPDYF_ASSERT(expr,msg) \ 79#define SPDYF_ASSERT(expr, msg) \
80 if(!(expr)){\ 80 if(!(expr)){\
81 SPDYF_PANIC(msg);\ 81 SPDYF_PANIC(msg);\
82 abort();\ 82 abort();\
diff --git a/src/microspdy/io.c b/src/microspdy/io.c
index 2053bd25..4d57ec2d 100644
--- a/src/microspdy/io.c
+++ b/src/microspdy/io.c
@@ -18,7 +18,7 @@
18 18
19/** 19/**
20 * @file io.c 20 * @file io.c
21 * @brief Functions for IO. 21 * @brief Generic functions for IO.
22 * @author Andrey Uzunov 22 * @author Andrey Uzunov
23 */ 23 */
24 24
@@ -29,7 +29,8 @@
29 29
30 30
31int 31int
32SPDYF_io_set_daemon(struct SPDY_Daemon *daemon, enum SPDY_IO_SUBSYSTEM io_subsystem) 32SPDYF_io_set_daemon(struct SPDY_Daemon *daemon,
33 enum SPDY_IO_SUBSYSTEM io_subsystem)
33{ 34{
34 switch(io_subsystem) 35 switch(io_subsystem)
35 { 36 {
@@ -54,7 +55,8 @@ SPDYF_io_set_daemon(struct SPDY_Daemon *daemon, enum SPDY_IO_SUBSYSTEM io_subsys
54 55
55 56
56int 57int
57SPDYF_io_set_session(struct SPDY_Session *session, enum SPDY_IO_SUBSYSTEM io_subsystem) 58SPDYF_io_set_session(struct SPDY_Session *session,
59 enum SPDY_IO_SUBSYSTEM io_subsystem)
58{ 60{
59 switch(io_subsystem) 61 switch(io_subsystem)
60 { 62 {
diff --git a/src/microspdy/io.h b/src/microspdy/io.h
index 42da001a..ae13890b 100644
--- a/src/microspdy/io.h
+++ b/src/microspdy/io.h
@@ -184,26 +184,33 @@ typedef int
184 * @return returned value will be used by the write function to return 184 * @return returned value will be used by the write function to return
185 */ 185 */
186typedef int 186typedef int
187(*SPDYF_IOAfterWrite) (struct SPDY_Session *session, int was_written); 187(*SPDYF_IOAfterWrite) (struct SPDY_Session *session,
188 int was_written);
188 189
189 190
190/** 191/**
191 * Sets callbacks for the daemon with regard to the IO subsystem. 192 * Sets callbacks for the daemon with regard to the IO subsystem.
192 * 193 *
193 * @param daemon 194 * @param daemon
195 * @param io_subsystem the IO subsystem that will
196 * be initialized and used by daemon.
194 * @return SPDY_YES on success or SPDY_NO otherwise 197 * @return SPDY_YES on success or SPDY_NO otherwise
195 */ 198 */
196int 199int
197SPDYF_io_set_daemon(struct SPDY_Daemon *daemon, enum SPDY_IO_SUBSYSTEM io_subsystem); 200SPDYF_io_set_daemon(struct SPDY_Daemon *daemon,
201 enum SPDY_IO_SUBSYSTEM io_subsystem);
198 202
199 203
200/** 204/**
201 * Sets callbacks for the session with regard to the IO subsystem. 205 * Sets callbacks for the session with regard to the IO subsystem.
202 * 206 *
203 * @param session 207 * @param session
208 * @param io_subsystem the IO subsystem that will
209 * be initialized and used by session.
204 * @return SPDY_YES on success or SPDY_NO otherwise 210 * @return SPDY_YES on success or SPDY_NO otherwise
205 */ 211 */
206int 212int
207SPDYF_io_set_session(struct SPDY_Session *session, enum SPDY_IO_SUBSYSTEM io_subsystem); 213SPDYF_io_set_session(struct SPDY_Session *session,
214 enum SPDY_IO_SUBSYSTEM io_subsystem);
208 215
209#endif 216#endif
diff --git a/src/microspdy/session.c b/src/microspdy/session.c
index 918b9fdf..131d3106 100644
--- a/src/microspdy/session.c
+++ b/src/microspdy/session.c
@@ -159,6 +159,8 @@ spdyf_handler_read_syn_stream (struct SPDY_Session *session)
159 free(name_value_strm); 159 free(name_value_strm);
160 } 160 }
161 161
162 //SPDYF_DEBUG("syn_stream received: id %i", session->current_stream_id);
163
162 //change state to wait for new frame 164 //change state to wait for new frame
163 session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; 165 session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER;
164 free(frame); 166 free(frame);
@@ -235,6 +237,8 @@ spdyf_handler_read_goaway (struct SPDY_Session *session)
235 case SPDY_GOAWAY_STATUS_INTERNAL_ERROR: 237 case SPDY_GOAWAY_STATUS_INTERNAL_ERROR:
236 break; 238 break;
237 } 239 }
240
241 //SPDYF_DEBUG("goaway received: status %i", status);
238 } 242 }
239 243
240 session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; 244 session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER;
@@ -256,7 +260,7 @@ spdyf_handler_read_rst_stream (struct SPDY_Session *session)
256 struct SPDYF_Control_Frame *frame; 260 struct SPDYF_Control_Frame *frame;
257 uint32_t stream_id; 261 uint32_t stream_id;
258 int32_t status_int; 262 int32_t status_int;
259 enum SPDY_RST_STREAM_STATUS status; 263 //enum SPDY_RST_STREAM_STATUS status; //for debug
260 struct SPDYF_Stream *stream; 264 struct SPDYF_Stream *stream;
261 265
262 SPDYF_ASSERT(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status, 266 SPDYF_ASSERT(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status,
@@ -285,7 +289,7 @@ spdyf_handler_read_rst_stream (struct SPDY_Session *session)
285 session->read_buffer_beginning += 4; 289 session->read_buffer_beginning += 4;
286 290
287 memcpy(&status_int, session->read_buffer + session->read_buffer_beginning, 4); 291 memcpy(&status_int, session->read_buffer + session->read_buffer_beginning, 4);
288 status = ntohl(status_int); 292 //status = ntohl(status_int); //for debug
289 session->read_buffer_beginning += 4; 293 session->read_buffer_beginning += 4;
290 294
291 session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; 295 session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER;
@@ -304,7 +308,7 @@ spdyf_handler_read_rst_stream (struct SPDY_Session *session)
304 stream = stream->next; 308 stream = stream->next;
305 } 309 }
306 310
307 SPDYF_DEBUG("Received RST_STREAM; status=%i; id=%i",status,stream_id); 311 //SPDYF_DEBUG("Received RST_STREAM; status=%i; id=%i",status,stream_id);
308 312
309 //do something according to the status 313 //do something according to the status
310 //TODO 314 //TODO
@@ -361,9 +365,7 @@ spdyf_handler_read_data (struct SPDY_Session *session)
361 if(NULL == stream || stream->is_in_closed || NULL == session->daemon->received_data_cb) 365 if(NULL == stream || stream->is_in_closed || NULL == session->daemon->received_data_cb)
362 { 366 {
363 if(NULL == session->daemon->received_data_cb) 367 if(NULL == session->daemon->received_data_cb)
364 SPDYF_DEBUG("No callback for DATA frame set"); 368 SPDYF_DEBUG("No callback for DATA frame set; Ignoring DATA frame!");
365
366 SPDYF_DEBUG("Ignoring DATA frame!");
367 369
368 //TODO send error? 370 //TODO send error?
369 371
@@ -405,6 +407,9 @@ spdyf_handler_read_data (struct SPDY_Session *session)
405 } 407 }
406 //else: do it later 408 //else: do it later
407 } 409 }
410
411 //SPDYF_DEBUG("data received: id %i", frame->stream_id);
412
408 session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; 413 session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER;
409 free(frame); 414 free(frame);
410 } 415 }
@@ -499,6 +504,8 @@ SPDYF_handler_write_syn_reply (struct SPDY_Session *session)
499 free(compressed_headers); 504 free(compressed_headers);
500 505
501 session->last_replied_to_stream_id = stream->stream_id; 506 session->last_replied_to_stream_id = stream->stream_id;
507
508 //SPDYF_DEBUG("syn_reply sent: id %i", stream->stream_id);
502 509
503 return SPDY_YES; 510 return SPDY_YES;
504} 511}
@@ -548,6 +555,8 @@ SPDYF_handler_write_goaway (struct SPDY_Session *session)
548 //data is not freed by the destroy function so: 555 //data is not freed by the destroy function so:
549 //free(response_queue->data); 556 //free(response_queue->data);
550 557
558 //SPDYF_DEBUG("goaway sent: status %i", NTOH31(*(uint32_t*)(response_queue->data)));
559
551 SPDYF_ASSERT(0 == session->write_buffer_beginning, "bug1"); 560 SPDYF_ASSERT(0 == session->write_buffer_beginning, "bug1");
552 SPDYF_ASSERT(session->write_buffer_offset == session->write_buffer_size, "bug2"); 561 SPDYF_ASSERT(session->write_buffer_offset == session->write_buffer_size, "bug2");
553 562
@@ -717,6 +726,8 @@ SPDYF_handler_write_data (struct SPDY_Session *session)
717 session->write_buffer_offset += ret; 726 session->write_buffer_offset += ret;
718 session->write_buffer_size = session->write_buffer_offset; 727 session->write_buffer_size = session->write_buffer_offset;
719 } 728 }
729
730 //SPDYF_DEBUG("data sent: id %i", NTOH31(data_frame.stream_id));
720 731
721 SPDYF_ASSERT(0 == session->write_buffer_beginning, "bug1"); 732 SPDYF_ASSERT(0 == session->write_buffer_beginning, "bug1");
722 SPDYF_ASSERT(session->write_buffer_offset == session->write_buffer_size, "bug2"); 733 SPDYF_ASSERT(session->write_buffer_offset == session->write_buffer_size, "bug2");
@@ -761,6 +772,8 @@ SPDYF_handler_write_rst_stream (struct SPDY_Session *session)
761 //data is not freed by the destroy function so: 772 //data is not freed by the destroy function so:
762 //free(response_queue->data); 773 //free(response_queue->data);
763 774
775 //SPDYF_DEBUG("rst_stream sent: id %i", NTOH31((((uint64_t)response_queue->data) & 0xFFFF0000) >> 32));
776
764 SPDYF_ASSERT(0 == session->write_buffer_beginning, "bug1"); 777 SPDYF_ASSERT(0 == session->write_buffer_beginning, "bug1");
765 SPDYF_ASSERT(session->write_buffer_offset == session->write_buffer_size, "bug2"); 778 SPDYF_ASSERT(session->write_buffer_offset == session->write_buffer_size, "bug2");
766 779
@@ -802,6 +815,8 @@ SPDYF_handler_write_window_update (struct SPDY_Session *session)
802 memcpy(session->write_buffer + session->write_buffer_offset, response_queue->data, 8); 815 memcpy(session->write_buffer + session->write_buffer_offset, response_queue->data, 8);
803 session->write_buffer_offset += 8; 816 session->write_buffer_offset += 8;
804 817
818 //SPDYF_DEBUG("window_update sent: id %i", NTOH31((((uint64_t)response_queue->data) & 0xFFFF0000) >> 32));
819
805 SPDYF_ASSERT(0 == session->write_buffer_beginning, "bug1"); 820 SPDYF_ASSERT(0 == session->write_buffer_beginning, "bug1");
806 SPDYF_ASSERT(session->write_buffer_offset == session->write_buffer_size, "bug2"); 821 SPDYF_ASSERT(session->write_buffer_offset == session->write_buffer_size, "bug2");
807 822
@@ -961,7 +976,8 @@ SPDYF_session_read (struct SPDY_Session *session)
961 976
962 977
963int 978int
964SPDYF_session_write (struct SPDY_Session *session, bool only_one_frame) 979SPDYF_session_write (struct SPDY_Session *session,
980 bool only_one_frame)
965{ 981{
966 unsigned int i; 982 unsigned int i;
967 int bytes_written; 983 int bytes_written;
@@ -1033,6 +1049,7 @@ SPDYF_session_write (struct SPDY_Session *session, bool only_one_frame)
1033 } 1049 }
1034 1050
1035 //just return from the loop to return from this function 1051 //just return from the loop to return from this function
1052 ++i;
1036 break; 1053 break;
1037 } 1054 }
1038 1055
@@ -1049,6 +1066,7 @@ SPDYF_session_write (struct SPDY_Session *session, bool only_one_frame)
1049 else 1066 else
1050 { 1067 {
1051 //no need to try the same frame again 1068 //no need to try the same frame again
1069 ++i;
1052 break; 1070 break;
1053 } 1071 }
1054 } 1072 }
diff --git a/src/microspdy/session.h b/src/microspdy/session.h
index e5c22c9b..7d8a1fe2 100644
--- a/src/microspdy/session.h
+++ b/src/microspdy/session.h
@@ -51,20 +51,22 @@ SPDYF_session_read (struct SPDY_Session *session);
51 * queue, and to write data to the TLS socket. 51 * queue, and to write data to the TLS socket.
52 * 52 *
53 * @param session SPDY_Session for which data will be written. 53 * @param session SPDY_Session for which data will be written.
54 * @return TODO document after changes 54 * @param only_one_frame when true, the function will write at most one
55 * SPDY_YES if something was written, the status was changed or 55 * SPDY frame to the underlying IO subsystem;
56 * response callback was called but did not provide data 56 * when false, the function will write up to
57 * @return SPDY_YES if something was written, session's status was 57 * session->max_num_frames SPDY frames
58 * changed or response callback was called but did not provide 58 * @return SPDY_YES if the session's internal writing state has changed:
59 * something was written and/or session's status was
60 * changed and/or response callback was called but did not provide
59 * data. It is possible that error occurred but was handled 61 * data. It is possible that error occurred but was handled
60 * and the status was therefore changed. 62 * and the status was therefore changed.
61 * SPDY_NO if nothing happened, e.g. the subsystem wants read/ 63 * SPDY_NO if nothing happened. However, it is possible that some
62 * write to be called again. However, it is possible that some
63 * frames were discarded within the call, e.g. frames belonging 64 * frames were discarded within the call, e.g. frames belonging
64 * to a closed stream. 65 * to a closed stream.
65 */ 66 */
66int 67int
67SPDYF_session_write (struct SPDY_Session *session, bool only_one_frame); 68SPDYF_session_write (struct SPDY_Session *session,
69 bool only_one_frame);
68 70
69 71
70/** 72/**