-
Notifications
You must be signed in to change notification settings - Fork 191
Expand file tree
/
Copy pathiovec_entry.hpp
More file actions
57 lines (48 loc) · 2.2 KB
/
Copy pathiovec_entry.hpp
File metadata and controls
57 lines (48 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
This file is part of libhttpserver
Copyright (C) 2011-2019 Sebastiano Merlino
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
*/
#if !defined (_HTTPSERVER_HPP_INSIDE_) && !defined (HTTPSERVER_COMPILATION)
#error "Only <httpserver.hpp> or <httpserverpp> can be included directly."
#endif
#ifndef SRC_HTTPSERVER_IOVEC_ENTRY_HPP_
#define SRC_HTTPSERVER_IOVEC_ENTRY_HPP_
#include <cstddef>
namespace httpserver {
// Library-defined POD describing a single scatter/gather buffer at the
// public API surface. Replaces `struct iovec` from <sys/uio.h>, keeping
// the public-header surface free of POSIX-only system headers.
//
// Layout is pinned to match POSIX `struct iovec` and libmicrohttpd's
// `MHD_IoVec` so the dispatch path can `reinterpret_cast` a contiguous
// array of iovec_entry into either C type at zero copy. The pinning
// asserts live next to the cast site in `src/detail/body.cpp`
// (iovec_body::materialize).
//
// `base` is `const void*` because libhttpserver never writes through
// these buffers on the response path.
//
// Both fields are accessed from src/http_response.cpp and src/detail/body.cpp
// (offsetof layout pinning + iovec construction); cppcheck analyses each TU
// in isolation and cannot see the uses, so unusedStructMember is suppressed
// per-member below.
struct iovec_entry {
// cppcheck-suppress unusedStructMember
const void* base;
// cppcheck-suppress unusedStructMember
std::size_t len;
};
} // namespace httpserver
#endif // SRC_HTTPSERVER_IOVEC_ENTRY_HPP_