Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
hpack.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2023 Emna Rekik
7 * Copyright (c) 2024 Nordic Semiconductor ASA
8 *
9 * SPDX-License-Identifier: Apache-2.0
10 */
11
12#ifndef ZEPHYR_INCLUDE_NET_HTTP_SERVER_HPACK_H_
13#define ZEPHYR_INCLUDE_NET_HTTP_SERVER_HPACK_H_
14
15#include <stddef.h>
16#include <stdint.h>
17
25#ifdef __cplusplus
26extern "C" {
27#endif
28
92};
93
94/* TODO Kconfig */
95#define HTTP2_HEADER_FIELD_MAX_LEN 256
96
97#if defined(CONFIG_HTTP_SERVER)
98#define HTTP_SERVER_HUFFMAN_DECODE_BUFFER_SIZE CONFIG_HTTP_SERVER_HUFFMAN_DECODE_BUFFER_SIZE
99#else
100#define HTTP_SERVER_HUFFMAN_DECODE_BUFFER_SIZE 0
101#endif
102
106 const char *name;
107
109 const char *value;
110
112 size_t name_len;
113
115 size_t value_len;
116
119
121 size_t datalen;
122};
123
124int http_hpack_huffman_decode(const uint8_t *encoded_buf, size_t encoded_len,
125 uint8_t *buf, size_t buflen);
126int http_hpack_huffman_encode(const uint8_t *str, size_t str_len,
127 uint8_t *buf, size_t buflen);
128int http_hpack_decode_header(const uint8_t *buf, size_t datalen,
129 struct http_hpack_header_buf *header);
130int http_hpack_encode_header(uint8_t *buf, size_t buflen,
131 struct http_hpack_header_buf *header);
132
133#ifdef __cplusplus
134}
135#endif
136
141#endif
#define HTTP_SERVER_HUFFMAN_DECODE_BUFFER_SIZE
Definition: hpack.h:100
int http_hpack_encode_header(uint8_t *buf, size_t buflen, struct http_hpack_header_buf *header)
int http_hpack_huffman_decode(const uint8_t *encoded_buf, size_t encoded_len, uint8_t *buf, size_t buflen)
http_hpack_static_key
Definition: hpack.h:29
int http_hpack_huffman_encode(const uint8_t *str, size_t str_len, uint8_t *buf, size_t buflen)
int http_hpack_decode_header(const uint8_t *buf, size_t datalen, struct http_hpack_header_buf *header)
@ HTTP_SERVER_HPACK_STATUS_200
Definition: hpack.h:38
@ HTTP_SERVER_HPACK_CONTENT_DISPOSITION
Definition: hpack.h:55
@ HTTP_SERVER_HPACK_REFRESH
Definition: hpack.h:82
@ HTTP_SERVER_HPACK_AGE
Definition: hpack.h:51
@ HTTP_SERVER_HPACK_PATH_INDEX
Definition: hpack.h:35
@ HTTP_SERVER_HPACK_SET_COOKIE
Definition: hpack.h:85
@ HTTP_SERVER_HPACK_LOCATION
Definition: hpack.h:76
@ HTTP_SERVER_HPACK_PROXY_AUTHORIZATION
Definition: hpack.h:79
@ HTTP_SERVER_HPACK_STATUS_304
Definition: hpack.h:41
@ HTTP_SERVER_HPACK_LAST_MODIFIED
Definition: hpack.h:74
@ HTTP_SERVER_HPACK_SCHEME_HTTPS
Definition: hpack.h:37
@ HTTP_SERVER_HPACK_PROXY_AUTHENTICATE
Definition: hpack.h:78
@ HTTP_SERVER_HPACK_ACCEPT_CHARSET
Definition: hpack.h:45
@ HTTP_SERVER_HPACK_STATUS_500
Definition: hpack.h:44
@ HTTP_SERVER_HPACK_CONTENT_TYPE
Definition: hpack.h:61
@ HTTP_SERVER_HPACK_HOST
Definition: hpack.h:68
@ HTTP_SERVER_HPACK_CONTENT_LANGUAGE
Definition: hpack.h:57
@ HTTP_SERVER_HPACK_ACCEPT_ENCODING
Definition: hpack.h:46
@ HTTP_SERVER_HPACK_STATUS_204
Definition: hpack.h:39
@ HTTP_SERVER_HPACK_EXPIRES
Definition: hpack.h:66
@ HTTP_SERVER_HPACK_IF_UNMODIFIED_SINCE
Definition: hpack.h:73
@ HTTP_SERVER_HPACK_MAX_FORWARDS
Definition: hpack.h:77
@ HTTP_SERVER_HPACK_REFERER
Definition: hpack.h:81
@ HTTP_SERVER_HPACK_LINK
Definition: hpack.h:75
@ HTTP_SERVER_HPACK_STATUS_400
Definition: hpack.h:42
@ HTTP_SERVER_HPACK_RANGE
Definition: hpack.h:80
@ HTTP_SERVER_HPACK_IF_MATCH
Definition: hpack.h:69
@ HTTP_SERVER_HPACK_PATH_ROOT
Definition: hpack.h:34
@ HTTP_SERVER_HPACK_INVALID
Definition: hpack.h:30
@ HTTP_SERVER_HPACK_SCHEME_HTTP
Definition: hpack.h:36
@ HTTP_SERVER_HPACK_CONTENT_LOCATION
Definition: hpack.h:59
@ HTTP_SERVER_HPACK_USER_AGENT
Definition: hpack.h:88
@ HTTP_SERVER_HPACK_STRICT_TRANSPORT_SECURITY
Definition: hpack.h:86
@ HTTP_SERVER_HPACK_VIA
Definition: hpack.h:90
@ HTTP_SERVER_HPACK_IF_RANGE
Definition: hpack.h:72
@ HTTP_SERVER_HPACK_ACCEPT_RANGES
Definition: hpack.h:48
@ HTTP_SERVER_HPACK_TRANSFER_ENCODING
Definition: hpack.h:87
@ HTTP_SERVER_HPACK_IF_MODIFIED_SINCE
Definition: hpack.h:70
@ HTTP_SERVER_HPACK_ALLOW
Definition: hpack.h:52
@ HTTP_SERVER_HPACK_RETRY_AFTER
Definition: hpack.h:83
@ HTTP_SERVER_HPACK_AUTHORIZATION
Definition: hpack.h:53
@ HTTP_SERVER_HPACK_ACCEPT
Definition: hpack.h:49
@ HTTP_SERVER_HPACK_CONTENT_LENGTH
Definition: hpack.h:58
@ HTTP_SERVER_HPACK_FROM
Definition: hpack.h:67
@ HTTP_SERVER_HPACK_VARY
Definition: hpack.h:89
@ HTTP_SERVER_HPACK_AUTHORITY
Definition: hpack.h:31
@ HTTP_SERVER_HPACK_CACHE_CONTROL
Definition: hpack.h:54
@ HTTP_SERVER_HPACK_EXPECT
Definition: hpack.h:65
@ HTTP_SERVER_HPACK_COOKIE
Definition: hpack.h:62
@ HTTP_SERVER_HPACK_IF_NONE_MATCH
Definition: hpack.h:71
@ HTTP_SERVER_HPACK_STATUS_206
Definition: hpack.h:40
@ HTTP_SERVER_HPACK_STATUS_404
Definition: hpack.h:43
@ HTTP_SERVER_HPACK_CONTENT_RANGE
Definition: hpack.h:60
@ HTTP_SERVER_HPACK_METHOD_POST
Definition: hpack.h:33
@ HTTP_SERVER_HPACK_CONTENT_ENCODING
Definition: hpack.h:56
@ HTTP_SERVER_HPACK_ACCESS_CONTROL_ALLOW_ORIGIN
Definition: hpack.h:50
@ HTTP_SERVER_HPACK_ETAG
Definition: hpack.h:64
@ HTTP_SERVER_HPACK_METHOD_GET
Definition: hpack.h:32
@ HTTP_SERVER_HPACK_SERVER
Definition: hpack.h:84
@ HTTP_SERVER_HPACK_WWW_AUTHENTICATE
Definition: hpack.h:91
@ HTTP_SERVER_HPACK_ACCEPT_LANGUAGE
Definition: hpack.h:47
@ HTTP_SERVER_HPACK_DATE
Definition: hpack.h:63
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
HTTP2 header field with decoding buffer.
Definition: hpack.h:104
size_t value_len
Length of the decoded header field value.
Definition: hpack.h:115
uint8_t buf[0]
Encoding/Decoding buffer.
Definition: hpack.h:118
const char * value
A pointer to the decoded header field value.
Definition: hpack.h:109
size_t datalen
Length of the data in the decoding buffer.
Definition: hpack.h:121
const char * name
A pointer to the decoded header field name.
Definition: hpack.h:106
size_t name_len
Length of the decoded header field name.
Definition: hpack.h:112