Pharos
0.7.23
Modern Web Framework & Web App Hosting Service.
Toggle main menu visibility
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
24
#include "
native_runtime_types.h
"
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
*/
50
int
native_dynamic_runtime_handle_request
(
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
*/
64
const
char
*
native_dynamic_runtime_host_profile
(
void
);
65
66
/** @} */
67
68
#endif
native_connection.h
Declares the native connection abstraction and transport metadata helpers.
native_dynamic_runtime_host_profile
const char * native_dynamic_runtime_host_profile(void)
Returns the canonical host profile string that this module handles.
Definition
native_dynamic_runtime.c:6490
native_dynamic_runtime_handle_request
int native_dynamic_runtime_handle_request(const AppRuntime *app, const HttpRequest *request, NativeConnection *connection)
Serves one dynamic-app request entirely in-process.
Definition
native_dynamic_runtime.c:6494
native_http_request.h
Declares the parsed HTTP request record and request parsing helpers.
native_runtime_types.h
Defines shared native runtime data structures used across the Pharos C runtime.
AppRuntime
Loaded runtime metadata for one Pharos app artifact.
Definition
native_runtime_types.h:37
HttpRequest
Parsed HTTP request fields extracted from a native connection.
Definition
native_http_request.h:16
NativeConnection
Accepted client connection and its resolved transport metadata.
Definition
native_connection.h:24
src
native_runtime
c
native_dynamic_runtime.h
Generated by
1.17.0