2 * nghttp2 - HTTP/2 C Library
4 * Copyright (c) 2012 Tatsuhiro Tsujikawa
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef NGHTTP2_SESSION_H
26 #define NGHTTP2_SESSION_H
30 #endif /* HAVE_CONFIG_H */
32 #include <nghttp2/nghttp2.h>
33 #include "nghttp2_pq.h"
34 #include "nghttp2_map.h"
35 #include "nghttp2_frame.h"
36 #include "nghttp2_hd.h"
37 #include "nghttp2_stream.h"
38 #include "nghttp2_outbound_item.h"
39 #include "nghttp2_int.h"
40 #include "nghttp2_buf.h"
41 #include "nghttp2_callbacks.h"
42 #include "nghttp2_mem.h"
48 NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE = 1 << 0,
49 NGHTTP2_OPTMASK_RECV_CLIENT_PREFACE = 1 << 1,
55 } nghttp2_outbound_state;
58 nghttp2_outbound_item *item;
59 nghttp2_bufs framebufs;
60 nghttp2_outbound_state state;
61 } nghttp2_active_outbound_item;
63 /* Buffer length for inbound raw byte stream used in
64 nghttp2_session_recv(). */
65 #define NGHTTP2_INBOUND_BUFFER_LENGTH 16384
67 /* Internal state when receiving incoming frame */
69 /* Receiving frame header */
70 NGHTTP2_IB_READ_CLIENT_PREFACE,
71 NGHTTP2_IB_READ_FIRST_SETTINGS,
73 NGHTTP2_IB_READ_NBYTE,
74 NGHTTP2_IB_READ_HEADER_BLOCK,
75 NGHTTP2_IB_IGN_HEADER_BLOCK,
76 NGHTTP2_IB_IGN_PAYLOAD,
77 NGHTTP2_IB_FRAME_SIZE_ERROR,
78 NGHTTP2_IB_READ_SETTINGS,
79 NGHTTP2_IB_READ_GOAWAY_DEBUG,
80 NGHTTP2_IB_EXPECT_CONTINUATION,
81 NGHTTP2_IB_IGN_CONTINUATION,
82 NGHTTP2_IB_READ_PAD_DATA,
85 } nghttp2_inbound_state;
87 #define NGHTTP2_INBOUND_NUM_IV 7
91 /* Storage for extension frame payload. frame->ext.payload points
92 to this structure to avoid frequent memory allocation. */
93 nghttp2_ext_frame_payload ext_frame_payload;
94 /* The received SETTINGS entry. The protocol says that we only cares
95 about the defined settings ID. If unknown ID is received, it is
96 ignored. We use last entry to hold minimum header table size if
97 same settings are multiple times. */
98 nghttp2_settings_entry iv[NGHTTP2_INBOUND_NUM_IV];
99 /* buffer pointers to small buffer, raw_sbuf */
101 /* buffer pointers to large buffer, raw_lbuf */
103 /* Large buffer, malloced on demand */
105 /* The number of entry filled in |iv| */
107 /* How many bytes we still need to receive for current frame */
109 /* padding length for the current frame */
111 nghttp2_inbound_state state;
112 /* Small buffer. Currently the largest contiguous chunk to buffer
113 is frame header. We buffer part of payload, but they are smaller
114 than frame header. */
115 uint8_t raw_sbuf[NGHTTP2_FRAME_HDLEN];
116 } nghttp2_inbound_frame;
119 uint32_t header_table_size;
120 uint32_t enable_push;
121 uint32_t max_concurrent_streams;
122 uint32_t initial_window_size;
123 uint32_t max_frame_size;
124 uint32_t max_header_list_size;
125 } nghttp2_settings_storage;
128 NGHTTP2_GOAWAY_NONE = 0,
129 /* Flag means that connection should be terminated after sending GOAWAY. */
130 NGHTTP2_GOAWAY_TERM_ON_SEND = 0x1,
131 /* Flag means GOAWAY to terminate session has been sent */
132 NGHTTP2_GOAWAY_TERM_SENT = 0x2,
133 /* Flag means GOAWAY was sent */
134 NGHTTP2_GOAWAY_SENT = 0x4,
135 /* Flag means GOAWAY was received */
136 NGHTTP2_GOAWAY_RECV = 0x8,
137 } nghttp2_goaway_flag;
139 struct nghttp2_session {
140 nghttp2_map /* <nghttp2_stream*> */ streams;
141 nghttp2_stream_roots roots;
142 /* Queue for outbound frames other than stream-creating HEADERS and
144 nghttp2_pq /* <nghttp2_outbound_item*> */ ob_pq;
145 /* Queue for outbound stream-creating HEADERS frame */
146 nghttp2_pq /* <nghttp2_outbound_item*> */ ob_ss_pq;
147 /* QUeue for DATA frame */
148 nghttp2_pq /* <nghttp2_outbound_item*> */ ob_da_pq;
149 nghttp2_active_outbound_item aob;
150 nghttp2_inbound_frame iframe;
151 nghttp2_hd_deflater hd_deflater;
152 nghttp2_hd_inflater hd_inflater;
153 nghttp2_session_callbacks callbacks;
154 /* Memory allocator */
156 /* Sequence number of outbound frame to maintain the order of
157 enqueue if priority is equal. */
159 /* Reset count of nghttp2_outbound_item's weight. We decrements
160 weight each time DATA is sent to simulate resource sharing. We
161 use priority queue and larger weight has the precedence. If
162 weight is reached to lowest weight, it resets to its initial
163 weight. If this happens, other items which have the lower weight
164 currently but same initial weight cannot send DATA until item
165 having large weight is decreased. To avoid this, we use this
166 cycle variable. Initally, this is set to 1. If weight gets
167 lowest weight, and if item's cycle == last_cycle, we increments
168 last_cycle and assigns it to item's cycle. Otherwise, just
169 assign last_cycle. In priority queue comparator, we first
170 compare items' cycle value. Lower cycle value has the
174 /* Points to the latest closed stream. NULL if there is no closed
175 stream. Only used when session is initialized as server. */
176 nghttp2_stream *closed_stream_head;
177 /* Points to the oldest closed stream. NULL if there is no closed
178 stream. Only used when session is initialized as server. */
179 nghttp2_stream *closed_stream_tail;
180 /* Points to the latest idle stream. NULL if there is no idle
181 stream. Only used when session is initialized as server .*/
182 nghttp2_stream *idle_stream_head;
183 /* Points to the oldest idle stream. NULL if there is no idle
184 stream. Only used when session is initialized as erver. */
185 nghttp2_stream *idle_stream_tail;
186 /* In-flight SETTINGS values. NULL does not necessarily mean there
187 is no in-flight SETTINGS. */
188 nghttp2_settings_entry *inflight_iv;
189 /* The number of entries in |inflight_iv|. -1 if there is no
190 in-flight SETTINGS. */
191 ssize_t inflight_niv;
192 /* The number of outgoing streams. This will be capped by
193 remote_settings.max_concurrent_streams. */
194 size_t num_outgoing_streams;
195 /* The number of incoming streams. This will be capped by
196 local_settings.max_concurrent_streams. */
197 size_t num_incoming_streams;
198 /* The number of closed streams still kept in |streams| hash. The
199 closed streams can be accessed through single linked list
200 |closed_stream_head|. The current implementation only keeps
201 incoming streams and session is initialized as server. */
202 size_t num_closed_streams;
203 /* The number of idle streams kept in |streams| hash. The idle
204 streams can be accessed through doubly linked list
205 |idle_stream_head|. The current implementation only keeps idle
206 streams if session is initialized as server. */
207 size_t num_idle_streams;
208 /* The number of bytes allocated for nvbuf */
210 /* Next Stream ID. Made unsigned int to detect >= (1 << 31). */
211 uint32_t next_stream_id;
212 /* The largest stream ID received so far */
213 int32_t last_recv_stream_id;
214 /* The largest stream ID which has been processed in some way. This
215 value will be used as last-stream-id when sending GOAWAY
217 int32_t last_proc_stream_id;
218 /* Counter of unique ID of PING. Wraps when it exceeds
219 NGHTTP2_MAX_UNIQUE_ID */
220 uint32_t next_unique_id;
221 /* This is the last-stream-ID we have sent in GOAWAY */
222 int32_t local_last_stream_id;
223 /* This is the value in GOAWAY frame received from remote endpoint. */
224 int32_t remote_last_stream_id;
225 /* Current sender window size. This value is computed against the
226 current initial window size of remote endpoint. */
227 int32_t remote_window_size;
228 /* Keep track of the number of bytes received without
229 WINDOW_UPDATE. This could be negative after submitting negative
230 value to WINDOW_UPDATE. */
231 int32_t recv_window_size;
232 /* The number of bytes consumed by the application and now is
233 subject to WINDOW_UPDATE. This is only used when auto
234 WINDOW_UPDATE is turned off. */
235 int32_t consumed_size;
236 /* The amount of recv_window_size cut using submitting negative
237 value to WINDOW_UPDATE */
238 int32_t recv_reduction;
239 /* window size for local flow control. It is initially set to
240 NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE and could be
241 increased/decreased by submitting WINDOW_UPDATE. See
242 nghttp2_submit_window_update(). */
243 int32_t local_window_size;
244 /* Settings value received from the remote endpoint. We just use ID
245 as index. The index = 0 is unused. */
246 nghttp2_settings_storage remote_settings;
247 /* Settings value of the local endpoint. */
248 nghttp2_settings_storage local_settings;
249 /* Option flags. This is bitwise-OR of 0 or more of nghttp2_optmask. */
251 /* Unacked local SETTINGS_MAX_CONCURRENT_STREAMS value. We use this
252 to refuse the incoming stream if it exceeds this value. */
253 uint32_t pending_local_max_concurrent_stream;
254 /* Nonzero if the session is server side. */
256 /* Flags indicating GOAWAY is sent and/or recieved. The flags are
257 composed by bitwise OR-ing nghttp2_goaway_flag. */
258 uint8_t goaway_flags;
261 /* Struct used when updating initial window size of each active
264 nghttp2_session *session;
265 int32_t new_window_size, old_window_size;
266 } nghttp2_update_window_size_arg;
269 nghttp2_session *session;
270 /* linked list of streams to close */
271 nghttp2_stream *head;
272 int32_t last_stream_id;
273 /* nonzero if GOAWAY is sent to peer, which means we are going to
274 close incoming streams. zero if GOAWAY is received from peer and
275 we are going to close outgoing streams. */
277 } nghttp2_close_stream_on_goaway_arg;
279 /* TODO stream timeout etc */
282 * Returns nonzero value if |stream_id| is initiated by local
285 int nghttp2_session_is_my_stream_id(nghttp2_session *session,
289 * Initializes |item|. No memory allocation is done in this function.
290 * Don't call nghttp2_outbound_item_free() until frame member is
293 void nghttp2_session_outbound_item_init(nghttp2_session *session,
294 nghttp2_outbound_item *item);
297 * Adds |item| to the outbound queue in |session|. When this function
298 * succeeds, it takes ownership of |item|. So caller must not free it
301 * This function returns 0 if it succeeds, or one of the following
302 * negative error codes:
306 * NGHTTP2_ERR_STREAM_CLOSED
307 * Stream already closed (DATA frame only)
309 int nghttp2_session_add_item(nghttp2_session *session,
310 nghttp2_outbound_item *item);
313 * Adds RST_STREAM frame for the stream |stream_id| with the error
314 * code |error_code|. This is a convenient function built on top of
315 * nghttp2_session_add_frame() to add RST_STREAM easily.
317 * This function simply returns 0 without adding RST_STREAM frame if
318 * given stream is in NGHTTP2_STREAM_CLOSING state, because multiple
319 * RST_STREAM for a stream is redundant.
321 * This function returns 0 if it succeeds, or one of the following
322 * negative error codes:
327 int nghttp2_session_add_rst_stream(nghttp2_session *session, int32_t stream_id,
328 uint32_t error_code);
331 * Adds PING frame. This is a convenient functin built on top of
332 * nghttp2_session_add_frame() to add PING easily.
334 * If the |opaque_data| is not NULL, it must point to 8 bytes memory
335 * region of data. The data pointed by |opaque_data| is copied. It can
336 * be NULL. In this case, 8 bytes NULL is used.
338 * This function returns 0 if it succeeds, or one of the following
339 * negative error codes:
344 int nghttp2_session_add_ping(nghttp2_session *session, uint8_t flags,
345 const uint8_t *opaque_data);
348 * Adds GOAWAY frame with the last-stream-ID |last_stream_id| and the
349 * error code |error_code|. This is a convenient function built on top
350 * of nghttp2_session_add_frame() to add GOAWAY easily. The
351 * |aux_flags| are bitwise-OR of one or more of
352 * nghttp2_goaway_aux_flag.
354 * This function returns 0 if it succeeds, or one of the following
355 * negative error codes:
359 * NGHTTP2_ERR_INVALID_ARGUMENT
360 * The |opaque_data_len| is too large.
362 int nghttp2_session_add_goaway(nghttp2_session *session, int32_t last_stream_id,
363 uint32_t error_code, const uint8_t *opaque_data,
364 size_t opaque_data_len, uint8_t aux_flags);
367 * Adds WINDOW_UPDATE frame with stream ID |stream_id| and
368 * window-size-increment |window_size_increment|. This is a convenient
369 * function built on top of nghttp2_session_add_frame() to add
370 * WINDOW_UPDATE easily.
372 * This function returns 0 if it succeeds, or one of the following
373 * negative error codes:
378 int nghttp2_session_add_window_update(nghttp2_session *session, uint8_t flags,
380 int32_t window_size_increment);
383 * Adds SETTINGS frame.
385 * This function returns 0 if it succeeds, or one of the following
386 * negative error codes:
391 int nghttp2_session_add_settings(nghttp2_session *session, uint8_t flags,
392 const nghttp2_settings_entry *iv, size_t niv);
395 * Creates new stream in |session| with stream ID |stream_id|,
396 * priority |pri_spec| and flags |flags|. The |flags| is bitwise OR
397 * of nghttp2_stream_flag. Since this function is called when initial
398 * HEADERS is sent or received, these flags are taken from it. The
399 * state of stream is set to |initial_state|. The |stream_user_data|
400 * is a pointer to the arbitrary user supplied data to be associated
403 * This function returns a pointer to created new stream object, or
406 nghttp2_stream *nghttp2_session_open_stream(nghttp2_session *session,
407 int32_t stream_id, uint8_t flags,
408 nghttp2_priority_spec *pri_spec,
409 nghttp2_stream_state initial_state,
410 void *stream_user_data);
413 * Closes stream whose stream ID is |stream_id|. The reason of closure
414 * is indicated by the |error_code|. When closing the stream,
415 * on_stream_close_callback will be called.
417 * If the session is initialized as server and |stream| is incoming
418 * stream, stream is just marked closed and this function calls
419 * nghttp2_session_keep_closed_stream() with |stream|. Otherwise,
420 * |stream| will be deleted from memory.
422 * This function returns 0 if it succeeds, or one the following
423 * negative error codes:
427 * NGHTTP2_ERR_INVALID_ARGUMENT
428 * The specified stream does not exist.
429 * NGHTTP2_ERR_CALLBACK_FAILURE
430 * The callback function failed.
432 int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id,
433 uint32_t error_code);
436 * Deletes |stream| from memory. After this function returns, stream
437 * cannot be accessed.
440 void nghttp2_session_destroy_stream(nghttp2_session *session,
441 nghttp2_stream *stream);
444 * Tries to keep incoming closed stream |stream|. Due to the
445 * limitation of maximum number of streams in memory, |stream| is not
446 * closed and just deleted from memory (see
447 * nghttp2_session_destroy_stream).
449 void nghttp2_session_keep_closed_stream(nghttp2_session *session,
450 nghttp2_stream *stream);
453 * Appends |stream| to linked list |session->idle_stream_head|. We
454 * apply fixed limit for list size. To fit into that limit, one or
455 * more oldest streams are removed from list as necessary.
457 void nghttp2_session_keep_idle_stream(nghttp2_session *session,
458 nghttp2_stream *stream);
461 * Detaches |stream| from idle streams linked list.
463 void nghttp2_session_detach_idle_stream(nghttp2_session *session,
464 nghttp2_stream *stream);
467 * Deletes closed stream to ensure that number of incoming streams
468 * including active and closed is in the maximum number of allowed
469 * stream. If |offset| is nonzero, it is decreased from the maximum
470 * number of allowed stream when comparing number of active and closed
471 * stream and the maximum number.
473 void nghttp2_session_adjust_closed_stream(nghttp2_session *session,
477 * Deletes idle stream to ensure that number of idle streams is in
480 void nghttp2_session_adjust_idle_stream(nghttp2_session *session);
483 * If further receptions and transmissions over the stream |stream_id|
484 * are disallowed, close the stream with error code NGHTTP2_NO_ERROR.
486 * This function returns 0 if it
487 * succeeds, or one of the following negative error codes:
489 * NGHTTP2_ERR_INVALID_ARGUMENT
490 * The specified stream does not exist.
492 int nghttp2_session_close_stream_if_shut_rdwr(nghttp2_session *session,
493 nghttp2_stream *stream);
495 int nghttp2_session_end_request_headers_received(nghttp2_session *session,
496 nghttp2_frame *frame,
497 nghttp2_stream *stream);
499 int nghttp2_session_end_response_headers_received(nghttp2_session *session,
500 nghttp2_frame *frame,
501 nghttp2_stream *stream);
503 int nghttp2_session_end_headers_received(nghttp2_session *session,
504 nghttp2_frame *frame,
505 nghttp2_stream *stream);
507 int nghttp2_session_on_request_headers_received(nghttp2_session *session,
508 nghttp2_frame *frame);
510 int nghttp2_session_on_response_headers_received(nghttp2_session *session,
511 nghttp2_frame *frame,
512 nghttp2_stream *stream);
514 int nghttp2_session_on_push_response_headers_received(nghttp2_session *session,
515 nghttp2_frame *frame,
516 nghttp2_stream *stream);
519 * Called when HEADERS is received, assuming |frame| is properly
520 * initialized. This function does first validate received frame and
521 * then open stream and call callback functions.
523 * This function returns 0 if it succeeds, or one of the following
524 * negative error codes:
528 * NGHTTP2_ERR_IGN_HEADER_BLOCK
529 * Frame was rejected and header block must be decoded but
530 * result must be ignored.
531 * NGHTTP2_ERR_CALLBACK_FAILURE
532 * The read_callback failed
534 int nghttp2_session_on_headers_received(nghttp2_session *session,
535 nghttp2_frame *frame,
536 nghttp2_stream *stream);
539 * Called when PRIORITY is received, assuming |frame| is properly
542 * This function returns 0 if it succeeds, or one of the following
543 * negative error codes:
547 * NGHTTP2_ERR_CALLBACK_FAILURE
548 * The read_callback failed
550 int nghttp2_session_on_priority_received(nghttp2_session *session,
551 nghttp2_frame *frame);
554 * Called when RST_STREAM is received, assuming |frame| is properly
557 * This function returns 0 if it succeeds, or one the following
558 * negative error codes:
562 * NGHTTP2_ERR_CALLBACK_FAILURE
563 * The read_callback failed
565 int nghttp2_session_on_rst_stream_received(nghttp2_session *session,
566 nghttp2_frame *frame);
569 * Called when SETTINGS is received, assuming |frame| is properly
570 * initialized. If |noack| is non-zero, SETTINGS with ACK will not be
571 * submitted. If |frame| has NGHTTP2_FLAG_ACK flag set, no SETTINGS
572 * with ACK will not be submitted regardless of |noack|.
574 * This function returns 0 if it succeeds, or one the following
575 * negative error codes:
579 * NGHTTP2_ERR_CALLBACK_FAILURE
580 * The read_callback failed
582 int nghttp2_session_on_settings_received(nghttp2_session *session,
583 nghttp2_frame *frame, int noack);
586 * Called when PUSH_PROMISE is received, assuming |frame| is properly
589 * This function returns 0 if it succeeds, or one of the following
590 * negative error codes:
594 * NGHTTP2_ERR_IGN_HEADER_BLOCK
595 * Frame was rejected and header block must be decoded but
596 * result must be ignored.
597 * NGHTTP2_ERR_CALLBACK_FAILURE
598 * The read_callback failed
600 int nghttp2_session_on_push_promise_received(nghttp2_session *session,
601 nghttp2_frame *frame);
604 * Called when PING is received, assuming |frame| is properly
607 * This function returns 0 if it succeeds, or one of the following
608 * negative error codes:
612 * NGHTTP2_ERR_CALLBACK_FAILURE
613 * The callback function failed.
615 int nghttp2_session_on_ping_received(nghttp2_session *session,
616 nghttp2_frame *frame);
619 * Called when GOAWAY is received, assuming |frame| is properly
622 * This function returns 0 if it succeeds, or one of the following
623 * negative error codes:
627 * NGHTTP2_ERR_CALLBACK_FAILURE
628 * The callback function failed.
630 int nghttp2_session_on_goaway_received(nghttp2_session *session,
631 nghttp2_frame *frame);
634 * Called when WINDOW_UPDATE is recieved, assuming |frame| is properly
637 * This function returns 0 if it succeeds, or one of the following
638 * negative error codes:
642 * NGHTTP2_ERR_CALLBACK_FAILURE
643 * The callback function failed.
645 int nghttp2_session_on_window_update_received(nghttp2_session *session,
646 nghttp2_frame *frame);
649 * Called when DATA is received, assuming |frame| is properly
652 * This function returns 0 if it succeeds, or one of the following
653 * negative error codes:
657 * NGHTTP2_ERR_CALLBACK_FAILURE
658 * The callback function failed.
660 int nghttp2_session_on_data_received(nghttp2_session *session,
661 nghttp2_frame *frame);
664 * Returns nghttp2_stream* object whose stream ID is |stream_id|. It
665 * could be NULL if such stream does not exist. This function returns
666 * NULL if stream is marked as closed.
668 nghttp2_stream *nghttp2_session_get_stream(nghttp2_session *session,
672 * This function behaves like nghttp2_session_get_stream(), but it
673 * returns stream object even if it is marked as closed or in
674 * NGHTTP2_STREAM_IDLE state.
676 nghttp2_stream *nghttp2_session_get_stream_raw(nghttp2_session *session,
680 * Packs DATA frame |frame| in wire frame format and stores it in
681 * |bufs|. Payload will be read using |aux_data->data_prd|. The
682 * length of payload is at most |datamax| bytes.
684 * This function returns 0 if it succeeds, or one of the following
685 * negative error codes:
687 * NGHTTP2_ERR_DEFERRED
688 * The DATA frame is postponed.
689 * NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
690 * The read_callback failed (stream error).
693 * NGHTTP2_ERR_CALLBACK_FAILURE
694 * The read_callback failed (session error).
696 int nghttp2_session_pack_data(nghttp2_session *session, nghttp2_bufs *bufs,
697 size_t datamax, nghttp2_frame *frame,
698 nghttp2_data_aux_data *aux_data);
701 * Returns top of outbound frame queue. This function returns NULL if
704 nghttp2_outbound_item *nghttp2_session_get_ob_pq_top(nghttp2_session *session);
707 * Pops and returns next item to send. If there is no such item,
708 * returns NULL. This function takes into account max concurrent
709 * streams. That means if session->ob_pq is empty but
710 * session->ob_ss_pq has item and max concurrent streams is reached,
711 * then this function returns NULL.
713 nghttp2_outbound_item *
714 nghttp2_session_pop_next_ob_item(nghttp2_session *session);
717 * Returns next item to send. If there is no such item, this function
718 * returns NULL. This function takes into account max concurrent
719 * streams. That means if session->ob_pq is empty but
720 * session->ob_ss_pq has item and max concurrent streams is reached,
721 * then this function returns NULL.
723 nghttp2_outbound_item *
724 nghttp2_session_get_next_ob_item(nghttp2_session *session);
727 * Updates local settings with the |iv|. The number of elements in the
728 * array pointed by the |iv| is given by the |niv|. This function
729 * assumes that the all settings_id member in |iv| are in range 1 to
730 * NGHTTP2_SETTINGS_MAX, inclusive.
732 * While updating individual stream's local window size, if the window
733 * size becomes strictly larger than NGHTTP2_MAX_WINDOW_SIZE,
734 * RST_STREAM is issued against such a stream.
736 * This function returns 0 if it succeeds, or one of the following
737 * negative error codes:
742 int nghttp2_session_update_local_settings(nghttp2_session *session,
743 nghttp2_settings_entry *iv,
747 * Re-prioritize |stream|. The new priority specification is
750 * This function returns 0 if it succeeds, or one of the following
751 * negative error codes:
756 int nghttp2_session_reprioritize_stream(nghttp2_session *session,
757 nghttp2_stream *stream,
758 const nghttp2_priority_spec *pri_spec);
761 * Terminates current |session| with the |error_code|. The |reason|
762 * is NULL-terminated debug string.
764 * This function returns 0 if it succeeds, or one of the following
765 * negative error codes:
769 * NGHTTP2_ERR_INVALID_ARGUMENT
770 * The |reason| is too long.
772 int nghttp2_session_terminate_session_with_reason(nghttp2_session *session,
776 #endif /* NGHTTP2_SESSION_H */