REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches
assets.h
Go to the documentation of this file.
1// Copyright (c) 2023 anabrid GmbH
2// Contact: https://www.anabrid.com/licensing/
3// SPDX-License-Identifier: MIT OR GPL-2.0-or-later
4
5#pragma once
6
7#include <cstdint> // uint32_t
8#include <stddef.h> // size_t
9#include <string.h> // strcmp
10
11namespace web {
12
34 struct StaticFile {
35 const char *filename;
36 const uint8_t *start;
37 const uint32_t size;
38
39 static constexpr int max_headers = 10;
42 struct HttpHeader {
43 const char* name;
44 const char* value;
46
48 };
49
50 // Get access to a table of static files, as defined by a proper implementation
51 // in assetsp.cpp
52 struct StaticAttic {
54 const size_t number_of_files;
56
59 const StaticFile* get_by_filename(const char* filename) {
60 for(size_t i=0; i<number_of_files; i++)
61 if(0 == strcmp(filename, files[i].filename)) return files+i;
62 return NULL;
63 }
64 };
65} // namespace web
uint32_t
Definition flasher.cpp:195
Definition assets.h:11
const StaticFile * files
Definition assets.h:53
const size_t number_of_files
Definition assets.h:54
const StaticFile * get_by_filename(const char *filename)
Lookup StaticFile by name.
Definition assets.h:59
up to 10 (unstructured) HTTP Headers, for instance Content-Type, Content-Encoding,...
Definition assets.h:42
Static web server file assets are compiled into the firmware code as binary objects.
Definition assets.h:34
const uint8_t * start
begin of content in memory, determined by linker symbol
Definition assets.h:36
const uint32_t size
size in bytes; determined by linker symbol
Definition assets.h:37
const uint32_t lastmod
C Unix timestamp for cache control.
Definition assets.h:47
const char * filename
Definition assets.h:35
static constexpr int max_headers
Definition assets.h:39
struct web::StaticFile::HttpHeader headers[max_headers]