Skip to main content

Module ipp

Module ipp 

Source
Expand description

IPP (Internet Printing Protocol) server implementation.

IPP is HTTP POST with a binary body (RFC 8010/8011); hyper carries the HTTP and this module parses just enough of the body to name the operation. The LLM supplies the answer as structured attributes and actions.rs encodes it — no action carries bytes.

There is no job queue and no printer state here: a Print-Job is not recorded anywhere, so a following Get-Job-Attributes is answered by the model from its own memory, not from a store this protocol keeps. That is deliberate.

Request parsing is shallow. Only the 8-byte header is decoded (version, operation-id, request-id). Attribute groups in the request are not parsed, so the model is told which operation was asked for but not, for instance, which printer-uri or document-format the client asked about, nor the document data of a Print-Job. Add attribute-group decoding here if the model needs to see it.

That shallowness is also why there is no recursive walk to bound here — the class of defect that kills the whole process with a SIGSEGV no tokio::spawn can contain. If request attribute decoding is ever added, it must stay iterative and must bound each value against the bytes actually present rather than against the length the peer declared.

The body is bounded before it is buffered. Incoming has no default limit, so an unauthenticated POST used to be able to ask this server to buffer whatever it chose to send. It is read frame by frame against MAX_IPP_BODY_BYTES and anything larger is refused with a well-formed client-error-request-entity-too-large and no LLM call.

The refusal is then drained, boundedly, before it is sent. Answering 413 and closing while the peer is still writing sends RST, which discards the response bytes already written — so the peer’s write fails and it never reads the refusal at all. See LINGER_DRAIN_BYTES.

Modules§

actions
IPP protocol actions implementation.

Structs§

IppServer
IPP server that delegates request handling to LLM

Constants§

MAX_IPP_BODY_BYTES
How much of a request body is read before the request is refused.