zephyr/subsys/net/lib/http/headers/server_internal.h
Jukka Rissanen 4b157b9099 net: lib: http_server: Initial HTTP server support
Original code developed as a GSoC 2023 project by Emna Rekik.

Code refactored in order to provide better bisectability
as the origical commits were not bisectable.

The server supports static and dynamic resources, managed by
HTTP_SERVICE/HTTP_RESOURCE macros.

Fixes #59685
Fixes #59686
Fixes #59688
Fixes #59690
Fixes #59670
Fixes #59700
Fixes #59684
Fixes #59693
Fixes #59693
Fixes #59694
Fixes #59699
Fixes #59696
Fixes #59688
Fixes #59690
Fixes #59670
Fixes #59700
Fixes #59685
Fixes #59686
Fixes #59688
Fixes #59691

Signed-off-by: Emna Rekik <emna.rekik007@gmail.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-30 13:25:22 +02:00

46 lines
1.7 KiB
C

/*
* Copyright (c) 2023, Emna Rekik
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef HTTP_SERVER_INTERNAL_H_
#define HTTP_SERVER_INTERNAL_H_
#include <stdbool.h>
#include <zephyr/net/http/server.h>
#include <zephyr/net/http/service.h>
#include <zephyr/net/http/status.h>
#include <zephyr/net/http/hpack.h>
#include <zephyr/net/http/frame.h>
/* HTTP1/HTTP2 state handling */
int handle_http_frame_rst_frame(struct http_client_ctx *client);
int handle_http_frame_goaway(struct http_client_ctx *client);
int handle_http_frame_settings(struct http_client_ctx *client);
int handle_http_frame_priority(struct http_client_ctx *client);
int handle_http_frame_continuation(struct http_client_ctx *client);
int handle_http_frame_window_update(struct http_client_ctx *client);
int handle_http_frame_header(struct http_client_ctx *client);
int handle_http_frame_headers(struct http_client_ctx *client);
int handle_http_frame_data(struct http_client_ctx *client);
int handle_http1_request(struct http_client_ctx *client);
int handle_http1_to_http2_upgrade(struct http_client_ctx *client);
int enter_http1_request(struct http_client_ctx *client);
int enter_http2_request(struct http_client_ctx *client);
int enter_http_done_state(struct http_client_ctx *client);
/* Others */
struct http_resource_detail *get_resource_detail(const char *path, int *len);
int http_server_sendall(struct http_client_ctx *client, const void *buf, size_t len);
void http_client_timer_restart(struct http_client_ctx *client);
/* TODO Could be static, but currently used in tests. */
int parse_http_frame_header(struct http_client_ctx *client);
const char *get_frame_type_name(enum http_frame_type type);
#endif /* HTTP_SERVER_INTERNAL_H_ */