2012-02-19 15:42:25 +01:00
|
|
|
/*
|
2014-03-30 12:09:21 +02:00
|
|
|
* nghttp2 - HTTP/2 C Library
|
2012-02-19 15:42:25 +01:00
|
|
|
*
|
|
|
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
2013-07-12 17:19:03 +02:00
|
|
|
#ifndef NGHTTP2_OUTBOUND_ITEM_H
|
|
|
|
#define NGHTTP2_OUTBOUND_ITEM_H
|
2012-02-19 15:42:25 +01:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif /* HAVE_CONFIG_H */
|
|
|
|
|
2013-07-12 17:19:03 +02:00
|
|
|
#include <nghttp2/nghttp2.h>
|
|
|
|
#include "nghttp2_frame.h"
|
2012-02-19 15:42:25 +01:00
|
|
|
|
2014-03-25 18:04:24 +01:00
|
|
|
/* A bit higher weight for non-DATA frames */
|
2014-04-01 15:54:20 +02:00
|
|
|
#define NGHTTP2_OB_EX_WEIGHT 300
|
2014-03-25 18:04:24 +01:00
|
|
|
/* Higher weight for SETTINGS */
|
2014-04-01 15:54:20 +02:00
|
|
|
#define NGHTTP2_OB_SETTINGS_WEIGHT 301
|
2014-03-25 18:04:24 +01:00
|
|
|
/* Highest weight for PING */
|
2014-04-01 15:54:20 +02:00
|
|
|
#define NGHTTP2_OB_PING_WEIGHT 302
|
2012-04-05 18:45:39 +02:00
|
|
|
|
2012-02-19 15:42:25 +01:00
|
|
|
typedef struct {
|
2013-07-12 17:19:03 +02:00
|
|
|
nghttp2_data_provider *data_prd;
|
2012-02-19 15:42:25 +01:00
|
|
|
void *stream_user_data;
|
2013-07-15 14:45:59 +02:00
|
|
|
} nghttp2_headers_aux_data;
|
2012-02-19 15:42:25 +01:00
|
|
|
|
|
|
|
typedef struct {
|
2013-12-06 15:17:38 +01:00
|
|
|
int64_t seq;
|
2014-05-08 16:07:29 +02:00
|
|
|
/* Reset count of weight. See comment for last_cycle in
|
|
|
|
nghttp2_session.h */
|
|
|
|
uint64_t cycle;
|
2013-12-06 15:17:38 +01:00
|
|
|
void *frame;
|
|
|
|
void *aux_data;
|
2013-07-12 17:19:03 +02:00
|
|
|
/* Type of |frame|. NGHTTP2_CTRL: nghttp2_frame*, NGHTTP2_DATA:
|
2014-01-27 13:22:33 +01:00
|
|
|
nghttp2_private_data* */
|
2013-07-12 17:19:03 +02:00
|
|
|
nghttp2_frame_category frame_cat;
|
2014-03-25 18:04:24 +01:00
|
|
|
/* The priority used in priority comparion. Larger is served
|
|
|
|
ealier. */
|
|
|
|
int32_t weight;
|
|
|
|
/* nonzero if this object is queued. */
|
|
|
|
uint8_t queued;
|
2013-07-12 17:19:03 +02:00
|
|
|
} nghttp2_outbound_item;
|
2012-02-19 15:42:25 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Deallocates resource for |item|. If |item| is NULL, this function
|
|
|
|
* does nothing.
|
|
|
|
*/
|
2013-07-12 17:19:03 +02:00
|
|
|
void nghttp2_outbound_item_free(nghttp2_outbound_item *item);
|
2012-02-19 15:42:25 +01:00
|
|
|
|
2013-07-12 17:19:03 +02:00
|
|
|
/* Macros to cast nghttp2_outbound_item.frame to the proper type. */
|
|
|
|
#define nghttp2_outbound_item_get_ctrl_frame(ITEM) ((nghttp2_frame*)ITEM->frame)
|
|
|
|
#define nghttp2_outbound_item_get_ctrl_frame_type(ITEM) \
|
2013-07-15 14:45:59 +02:00
|
|
|
(((nghttp2_frame*)ITEM->frame)->hd.type)
|
2014-01-27 13:22:33 +01:00
|
|
|
#define nghttp2_outbound_item_get_data_frame(ITEM) \
|
|
|
|
((nghttp2_private_data*)ITEM->frame)
|
2012-03-29 16:59:51 +02:00
|
|
|
|
2013-07-12 17:19:03 +02:00
|
|
|
#endif /* NGHTTP2_OUTBOUND_ITEM_H */
|