ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
mdl_session.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <stddef.h>
18#include <stdint.h>
19
20#include "mdl_net.h"
21#include "mdl_robots.h"
22#include "ra8_io_stream.h"
23
25typedef enum : uint32_t {
27 k_mdl_ua_max = 256U,
29
47
72bool mdl_session_build_ua(const char* contact, char* out, size_t cap);
73
83const char* mdl_session_ua_token(void);
84
108void mdl_session_init(mdl_session_t* session,
109 mdl_net_iface_t* net,
110 const char* user_agent,
111 ra8_io_stream_t* diagnostic,
112 bool honor_robots);
113
141bool mdl_session_url_allowed(mdl_session_t* session, const char* url, uint32_t* crawl_delay_ms);
Streaming HTTP(S) GET seam (a real function-pointer vtable) for the host manga downloader (v0).
robots.txt parser, path matcher, and per-host cache.
bool mdl_session_url_allowed(mdl_session_t *session, const char *url, uint32_t *crawl_delay_ms)
Decide whether url may be fetched under robots.txt, and its delay.
mdl_session_size_t
Fixed session buffer sizes.
Definition mdl_session.h:25
@ k_mdl_session_scratch
robots.txt fetch scratch bytes.
Definition mdl_session.h:26
@ k_mdl_ua_max
Built User-Agent buffer bytes.
Definition mdl_session.h:27
void mdl_session_init(mdl_session_t *session, mdl_net_iface_t *net, const char *user_agent, ra8_io_stream_t *diagnostic, bool honor_robots)
Initialise a session over a network backend.
Definition mdl_session.c:61
const char * mdl_session_ua_token(void)
The robots.txt product token this tool matches on ("mdl").
Definition mdl_session.c:42
bool mdl_session_build_ua(const char *contact, char *out, size_t cap)
Build the truthful default User-Agent into out.
Definition mdl_session.c:47
ra8_io targetable byte-stream facade – one writer, many destinations.
A network backend handle: an immutable method table plus its state.
Fixed-size per-host robots.txt cache for one run.
Definition mdl_robots.h:185
One download session's identity and robots.txt state.
Definition mdl_session.h:39
mdl_robots_cache_t cache
Per-host robots cache.
Definition mdl_session.h:44
mdl_net_iface_t * net
Backend used for robots.txt fetches.
Definition mdl_session.h:40
bool honor_robots
False disables all robots gating.
Definition mdl_session.h:43
const char * user_agent
Full UA header (caller-owned).
Definition mdl_session.h:41
ra8_io_stream_t * diagnostic
Borrowed diagnostic byte sink.
Definition mdl_session.h:42
char scratch[k_mdl_session_scratch]
Fetch scratch.
Definition mdl_session.h:45
Caller-allocated byte-stream handle binding a sink to its context.