package rpmfile

  1. Overview
  2. Docs

Module Rpmfile.ReaderSource

The module provides functions to read RPM packages from incoming byte streams.

Sourcemodule In = Bytream.In

Short alias to incoming byte stream.

Input RPM package functions

From channels

Sourceval from_channel_without_payload : in_channel -> Metadata.t

from_channel_without_payload ic

Similar to input_package_without_payload, but for channels.

Sourceval from_channel_with_payload : in_channel -> Metadata.t * Payload.t

from_channel_with_payload ic

Similar to from_channel_without_payload, but returns payload with metadata.

From incoming byte streams

Sourceval input_metadata_only : In.t -> Metadata.t

input_metadata_only in_stream

Input only package's metadata from incoming byte stream, without skipping payload. The remaining payload is available for the user to analyze on their own.

See also

  • If you want to get the package's payload and its metadata, you should see it with input_metadata_with and input_package_with...payload. It's very important, because the value of the RPMTAG_PAYLOADSIZE tag is not just the payload size, but also includes the size of the package header plus the payload.
  • raises Error

    if parsing fails

Sourceval input_package_without_payload : In.t -> Metadata.t

input_package_without_payload in_stream

Similar to the input_metadata_only function, but skip the payload section from the stream's source.

  • raises Error

    if parsing fails

With payload

Sourceval input_metadata_with : In.t -> (Metadata.t -> int -> 'a) -> 'a

input_metadata_with in_stream f

Input the package's metadata and call the f function to handle the payload section of the package.

Example

Rpmfile.Reader.input_metadata_with in_stream
@@ fun metadata payload_size ->
(* ... *)
  • raises Error

    if parsing fails

Sourceval input_metadata_with_string_payload : In.t -> Metadata.t * string

input_package_with_string_payload in_stream

Sourceval input_metadata_with_bigstring_payload : In.t -> Metadata.t * Bstr.t

input_package_with_bigstring_payload in_stream

Decoder's error

Sourcetype error =
  1. | Invalid_rpm_code
  2. | Illegal_rpm_version
  3. | Illegal_rpm_metadata_type
  4. | Invalid_header_record_code
  5. | Illegal_index_record_kind
  6. | Not_found_payload_size
Sourceexception Error of error