Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
native_dynamic_runtime.h
Go to the documentation of this file.
1/**
2 * @file
3 * @brief In-process dynamic-app request handler for the Pharos native runtime.
4 *
5 * This module owns the primary entry point for serving dynamic-app requests
6 * directly inside the Pharos binary process. It replaces the earlier
7 * architecture where every dynamic-app request spawned a child process via
8 * @c spawn_app_request().
9 *
10 * The handler is responsible for:
11 * - loading the route fixture for the target app,
12 * - matching the incoming request path against declared routes,
13 * - serving static assets from the artifact directory,
14 * - delegating page and action routes to the dispatch layer, and
15 * - writing the final HTTP response back through the connection.
16 *
17 * @see native_dynamic_dispatch.h for the route-matching layer.
18 * @see native_dynamic_request_fields.h for request field extraction helpers.
19 */
20
21#ifndef PHAROS_NATIVE_DYNAMIC_RUNTIME_H
22#define PHAROS_NATIVE_DYNAMIC_RUNTIME_H
23
25#include "native_connection.h"
26#include "native_http_request.h"
27
28/** @name Dynamic runtime entry points
29 * @{
30 */
31
32/**
33 * @brief Serves one dynamic-app request entirely in-process.
34 *
35 * This is the canonical entry point that replaces the former
36 * @c spawn_app_request() path for apps whose @c host_profile is
37 * @c "dynamic-app". The function reads the app's route fixture,
38 * resolves the appropriate handler, and writes the HTTP response
39 * directly to @p connection.
40 *
41 * Static-only and non-dynamic host profiles continue to use their
42 * existing code paths; this function is called only for dynamic-app
43 * requests.
44 *
45 * @param app Finalized app runtime metadata (artifact dir, state, etc.).
46 * @param request Parsed HTTP request record.
47 * @param connection Connection to write the response to.
48 * @return 0 on success, or a non-zero native status code on failure.
49 */
51 const AppRuntime *app,
52 const HttpRequest *request,
53 NativeConnection *connection
54);
55
56/**
57 * @brief Returns the canonical host profile string that this module handles.
58 *
59 * Useful for callers that need to decide which request path to use
60 * without duplicating the profile name string.
61 *
62 * @return Pointer to a string literal; never NULL.
63 */
65
66/** @} */
67
68#endif
Declares the native connection abstraction and transport metadata helpers.
const char * native_dynamic_runtime_host_profile(void)
Returns the canonical host profile string that this module handles.
int native_dynamic_runtime_handle_request(const AppRuntime *app, const HttpRequest *request, NativeConnection *connection)
Serves one dynamic-app request entirely in-process.
Declares the parsed HTTP request record and request parsing helpers.
Defines shared native runtime data structures used across the Pharos C runtime.
Loaded runtime metadata for one Pharos app artifact.
Parsed HTTP request fields extracted from a native connection.
Accepted client connection and its resolved transport metadata.