Add nghttp2 - HTTP/2 C Library component

This commit is contained in:
Mahavir Jain 2021-12-30 13:19:03 +05:30
parent e8ced5143a
commit 7ba75e760e
8 changed files with 111 additions and 0 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "cbor/tinycbor"]
path = cbor/tinycbor
url = https://github.com/intel/tinycbor.git
[submodule "nghttp/nghttp2"]
path = nghttp/nghttp2
url = https://github.com/nghttp2/nghttp2.git

29
nghttp/CMakeLists.txt Normal file
View File

@ -0,0 +1,29 @@
set(srcs
"nghttp2/lib/nghttp2_buf.c"
"nghttp2/lib/nghttp2_callbacks.c"
"nghttp2/lib/nghttp2_debug.c"
"nghttp2/lib/nghttp2_frame.c"
"nghttp2/lib/nghttp2_hd.c"
"nghttp2/lib/nghttp2_hd_huffman.c"
"nghttp2/lib/nghttp2_hd_huffman_data.c"
"nghttp2/lib/nghttp2_helper.c"
"nghttp2/lib/nghttp2_http.c"
"nghttp2/lib/nghttp2_map.c"
"nghttp2/lib/nghttp2_mem.c"
"nghttp2/lib/nghttp2_npn.c"
"nghttp2/lib/nghttp2_option.c"
"nghttp2/lib/nghttp2_outbound_item.c"
"nghttp2/lib/nghttp2_pq.c"
"nghttp2/lib/nghttp2_priority_spec.c"
"nghttp2/lib/nghttp2_queue.c"
"nghttp2/lib/nghttp2_rcbuf.c"
"nghttp2/lib/nghttp2_session.c"
"nghttp2/lib/nghttp2_stream.c"
"nghttp2/lib/nghttp2_submit.c"
"nghttp2/lib/nghttp2_version.c")
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS port/include nghttp2/lib/includes
PRIV_INCLUDE_DIRS port/private_include)
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DHAVE_CONFIG_H")

1
nghttp/LICENSE Symbolic link
View File

@ -0,0 +1 @@
nghttp2/COPYING

1
nghttp/README.md Symbolic link
View File

@ -0,0 +1 @@
nghttp2/README.rst

5
nghttp/idf_component.yml Normal file
View File

@ -0,0 +1,5 @@
version: "1.41.0"
description: "nghttp2 - HTTP/2 C Library"
url: https://github.com/espressif/idf-extra-components/tree/master/nghttp
dependencies:
idf: ">=5.0"

1
nghttp/nghttp2 Submodule

@ -0,0 +1 @@
Subproject commit 8f7b008b158e12de0e58247afd170f127dbb6456

View File

@ -0,0 +1,42 @@
/*
* nghttp2 - HTTP/2 C Library
*
* Copyright (c) 2012, 2013 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.
*/
#ifndef NGHTTP2VER_H
#define NGHTTP2VER_H
/**
* @macro
* Version number of the nghttp2 library release
*/
#define NGHTTP2_VERSION "v1.22.0"
/**
* @macro
* Numerical representation of the version number of the nghttp2 library
* release. This is a 24 bit number with 8 bits for major number, 8 bits
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
*/
#define NGHTTP2_VERSION_NUM 0x012200
#endif /* NGHTTP2VER_H */

View File

@ -0,0 +1,29 @@
#ifndef __HAVE_CONFIG_H_
#define __HAVE_CONFIG_H_
#define _U_
#define SIZEOF_INT_P 2
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#if (!defined(nghttp_unlikely))
#define nghttp_unlikely(Expression) !!(Expression)
#endif
#define nghttp_ASSERT(Expression) do{if (!(Expression)) printf("%d\n", __LINE__);}while(0)
#define CU_ASSERT(a) nghttp_ASSERT(a)
#define CU_ASSERT_FATAL(a) nghttp_ASSERT(a)
#define NGHTTP_PLATFORM_HTONS(_n) ((uint16_t)((((_n) & 0xff) << 8) | (((_n) >> 8) & 0xff)))
#define NGHTTP_PLATFORM_HTONL(_n) ((uint32_t)( (((_n) & 0xff) << 24) | (((_n) & 0xff00) << 8) | (((_n) >> 8) & 0xff00) | (((_n) >> 24) & 0xff) ))
#define htons(x) NGHTTP_PLATFORM_HTONS(x)
#define ntohs(x) NGHTTP_PLATFORM_HTONS(x)
#define htonl(x) NGHTTP_PLATFORM_HTONL(x)
#define ntohl(x) NGHTTP_PLATFORM_HTONL(x)
#endif // __HAVE_CONFIG_H_