moon-sdp

    RFC 8866 SDP parser, canonical writer, validator and RFC 3264 offer/answer analysis toolkit for MoonBit.

    sdp
    rfc8866
    rfc3264
    offer-answer
    rtp
    protocol
    moonbit
    Download zip
    Author
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    2 months ago
    Downloads
    73

    No dependencies

    #moon-sdp

    CI License

    moon-sdp 是纯 MoonBit 实现的 SDP(Session Description Protocol)数据层工具库。 它覆盖 RFC 8866 核心字段的有界解析、类型化模型、保真/规范写出、语义校验,并 提供 RFC 3264 基础 offer/answer 静态分析。运行时完全离线,不实现 SIP、RTP、 WebRTC、ICE 或媒体传输。

    #功能

    • strict/compatible 解析模式,八维资源限制与不回显输入的结构化错误。
    • session/media 两级模型;未知扩展属性完整保留。
    • rtpmap、fmtp、方向、有效连接和属性继承的类型化视图。
    • write_preserve 原文保真和 write_canonical 确定性 CRLF 输出。
    • RFC 8866 语义校验、IANA SDP Parameters 离线快照、RTP payload 检查。
    • media/mid/codec 查询、统计、工程审计和 RFC 3264 offer/answer 检查。
    • JSON CLI sdp-tool 与恰好 5 个可运行示例。

    #快速开始

    match @sdp.parse(input) {
    Err(error) => println(error.to_display())
    Ok(document) => {
    println(document.to_debug_string())
    println(@sdp.validate(document).to_text())
    }
    }

    D:\Moonbit\bin\moon.exe test --target native D:\Moonbit\bin\moon.exe run examples/parse --target native D:\Moonbit\bin\moon.exe run cmd/sdp-tool --target native -- version .\scripts\verify_all.ps1

    #实测验证

    指标结果
    具名测试158
    三目标执行量474 次,全部通过
    确定性属性用例4000 组
    一键验证32/32 步通过
    核心/测试/CLI/示例代码3167/906/70/40 行
    MoonBit 非空非注释总计4183 行
    示例5 个,三目标构建通过

    统计方式见 scripts/count_code.py,完整复现见 docs/reproduction.md。

    #文档

    #规范与许可

    主要依据 RFC 8866 和 RFC 3264;参数识别依据带日期的 IANA 离线快照。标准文本没有 复制进本仓库,详见 THIRD_PARTY_NOTICES。项目采用 Apache-2.0 许可证。

    Attribute

    pub struct Attribute {
    name : String
    value : String?
    line : Int
    }

    A generic a= attribute. The value is absent for property attributes.

    Attribute::is_property

    fn Attribute::is_property(self : Attribute) -> Bool

    Attribute::line

    fn Attribute::line(self : Attribute) -> Int

    Attribute::name

    fn Attribute::name(self : Attribute) -> String

    Attribute::value

    fn Attribute::value(self : Attribute) -> String?

    AuditFinding

    pub struct AuditFinding {
    severity : AuditSeverity
    code : String
    scope : String
    message : String
    }

    AuditFinding::code

    fn AuditFinding::code(self : AuditFinding) -> String

    AuditFinding::message

    fn AuditFinding::message(self : AuditFinding) -> String

    AuditFinding::scope

    fn AuditFinding::scope(self : AuditFinding) -> String

    AuditFinding::severity

    fn AuditFinding::severity(self : AuditFinding) -> AuditSeverity

    AuditReport

    pub struct AuditReport {
    findings : Array[AuditFinding]
    }

    AuditReport::finding_count

    fn AuditReport::finding_count(self : AuditReport) -> Int

    AuditReport::findings

    fn AuditReport::findings(self : AuditReport) -> Array[AuditFinding]

    AuditReport::high_count

    fn AuditReport::high_count(self : AuditReport) -> Int

    AuditReport::low_count

    fn AuditReport::low_count(self : AuditReport) -> Int

    AuditReport::medium_count

    fn AuditReport::medium_count(self : AuditReport) -> Int

    AuditReport::to_text

    fn AuditReport::to_text(self : AuditReport) -> String

    AuditSeverity

    pub enum AuditSeverity {
    High
    Medium
    Low
    }

    AuditSeverity::to_string

    fn AuditSeverity::to_string(self : AuditSeverity) -> String

    Bandwidth

    pub struct Bandwidth {
    modifier : String
    value : Int
    }

    A b= bandwidth field.

    Bandwidth::modifier

    fn Bandwidth::modifier(self : Bandwidth) -> String

    Bandwidth::value

    fn Bandwidth::value(self : Bandwidth) -> Int

    Connection

    pub struct Connection {
    network_type : String
    address_type : String
    connection_address : String
    ttl : Int?
    address_count : Int?
    }

    A c= connection field.

    Connection::address

    fn Connection::address(self : Connection) -> String

    Connection::address_count

    fn Connection::address_count(self : Connection) -> Int?

    Connection::address_type

    fn Connection::address_type(self : Connection) -> String

    Connection::network_type

    fn Connection::network_type(self : Connection) -> String

    Connection::ttl

    fn Connection::ttl(self : Connection) -> Int?

    Direction

    pub enum Direction {
    SendRecv
    SendOnly
    RecvOnly
    Inactive
    Unspecified
    }

    A typed direction attribute.

    Direction::to_string

    fn Direction::to_string(self : Direction) -> String

    FormatParameters

    pub struct FormatParameters {
    format : String
    parameters : String
    }

    A typed a=fmtp mapping.

    FormatParameters::format

    fn FormatParameters::format(self : FormatParameters) -> String

    FormatParameters::parameters

    fn FormatParameters::parameters(self : FormatParameters) -> String

    IssueSeverity

    pub enum IssueSeverity {
    Error
    Warning
    Info
    }

    RFC 8866 validation and interoperability diagnostics.

    IssueSeverity::to_string

    fn IssueSeverity::to_string(self : IssueSeverity) -> String

    Limits

    pub struct Limits {
    max_input_bytes : Int
    max_lines : Int
    max_line_bytes : Int
    max_media : Int
    max_attributes : Int
    max_formats_per_media : Int
    max_timings : Int
    max_repeats_per_timing : Int
    }

    Resource limits applied before and during parsing.

    Limits::max_attributes

    fn Limits::max_attributes(self : Limits) -> Int

    Limits::max_formats_per_media

    fn Limits::max_formats_per_media(self : Limits) -> Int

    Limits::max_input_bytes

    fn Limits::max_input_bytes(self : Limits) -> Int

    Limits::max_line_bytes

    fn Limits::max_line_bytes(self : Limits) -> Int

    Limits::max_lines

    fn Limits::max_lines(self : Limits) -> Int

    Limits::max_media

    fn Limits::max_media(self : Limits) -> Int

    Limits::max_repeats_per_timing

    fn Limits::max_repeats_per_timing(self : Limits) -> Int

    Limits::max_timings

    fn Limits::max_timings(self : Limits) -> Int

    MediaDescription

    pub struct MediaDescription {
    media : String
    port : Int
    port_count : Int
    protocol : String
    formats : Array[String]
    information : String?
    connections : Array[Connection]
    bandwidths : Array[Bandwidth]
    attributes : Array[Attribute]
    source_lines : Array[SdpLine]
    }

    A single RFC 8866 media description beginning with m=.

    MediaDescription::attribute_value

    fn MediaDescription::attribute_value(self : MediaDescription, name : String) -> String?

    Returns the first attribute value with the requested name.

    MediaDescription::attributes

    MediaDescription::attributes_named

    fn MediaDescription::attributes_named(self : MediaDescription, name : String) -> Array[Attribute]

    Returns all media-level attributes with the requested case-insensitive name.

    MediaDescription::bandwidths

    MediaDescription::connections

    MediaDescription::direction

    fn MediaDescription::direction(self : MediaDescription, session_attributes : Array[Attribute]) -> Direction

    Computes the effective RFC 3264 direction, inheriting from the session.

    MediaDescription::format_parameters

    fn MediaDescription::format_parameters(self : MediaDescription) -> Array[FormatParameters]

    Returns every successfully parsed format-parameter mapping.

    MediaDescription::formats

    fn MediaDescription::formats(self : MediaDescription) -> Array[String]

    MediaDescription::has_format

    fn MediaDescription::has_format(self : MediaDescription, format : String) -> Bool

    Whether a media section advertises a format token on its m= line.

    MediaDescription::information

    fn MediaDescription::information(self : MediaDescription) -> String?

    MediaDescription::is_rejected

    fn MediaDescription::is_rejected(self : MediaDescription) -> Bool

    MediaDescription::media

    fn MediaDescription::media(self : MediaDescription) -> String

    MediaDescription::port

    fn MediaDescription::port(self : MediaDescription) -> Int

    MediaDescription::port_count

    fn MediaDescription::port_count(self : MediaDescription) -> Int

    MediaDescription::protocol

    fn MediaDescription::protocol(self : MediaDescription) -> String

    MediaDescription::rtp_map_for

    fn MediaDescription::rtp_map_for(self : MediaDescription, payload_type : Int) -> RtpMap?

    Finds an RTP mapping by numeric payload type.

    MediaDescription::rtp_maps

    Returns every successfully parsed RTP mapping in media order.

    MediaDescription::source_lines

    fn MediaDescription::source_lines(self : MediaDescription) -> Array[SdpLine]

    OfferAnswerIssue

    pub struct OfferAnswerIssue {
    code : String
    media_index : Int
    message : String
    reference : String
    }

    OfferAnswerIssue::code

    fn OfferAnswerIssue::code(self : OfferAnswerIssue) -> String

    OfferAnswerIssue::media_index

    fn OfferAnswerIssue::media_index(self : OfferAnswerIssue) -> Int

    OfferAnswerIssue::message

    fn OfferAnswerIssue::message(self : OfferAnswerIssue) -> String

    OfferAnswerIssue::reference

    fn OfferAnswerIssue::reference(self : OfferAnswerIssue) -> String

    OfferAnswerReport

    pub struct OfferAnswerReport {
    compatible : Bool
    issues : Array[OfferAnswerIssue]
    accepted_media : Int
    rejected_media : Int
    }

    OfferAnswerReport::accepted_media

    fn OfferAnswerReport::accepted_media(self : OfferAnswerReport) -> Int

    OfferAnswerReport::compatible

    fn OfferAnswerReport::compatible(self : OfferAnswerReport) -> Bool

    OfferAnswerReport::issue_count

    fn OfferAnswerReport::issue_count(self : OfferAnswerReport) -> Int

    OfferAnswerReport::issues

    OfferAnswerReport::rejected_media

    fn OfferAnswerReport::rejected_media(self : OfferAnswerReport) -> Int

    OfferAnswerReport::to_text

    fn OfferAnswerReport::to_text(self : OfferAnswerReport) -> String

    Origin

    pub struct Origin {
    username : String
    session_id : String
    session_version : String
    network_type : String
    address_type : String
    unicast_address : String
    }

    The o= origin field.

    Origin::address_type

    fn Origin::address_type(self : Origin) -> String

    Origin::network_type

    fn Origin::network_type(self : Origin) -> String

    Origin::session_id

    fn Origin::session_id(self : Origin) -> String

    Origin::session_version

    fn Origin::session_version(self : Origin) -> String

    Origin::unicast_address

    fn Origin::unicast_address(self : Origin) -> String

    Origin::username

    fn Origin::username(self : Origin) -> String

    ParseOptions

    pub struct ParseOptions {
    strict : Bool
    allow_lf : Bool
    allow_obsolete_key : Bool
    limits : Limits
    }

    Parser policy. Strict mode rejects non-CRLF input and obsolete k= lines.

    ParseOptions::allow_lf

    fn ParseOptions::allow_lf(self : ParseOptions) -> Bool

    ParseOptions::allow_obsolete_key

    fn ParseOptions::allow_obsolete_key(self : ParseOptions) -> Bool

    ParseOptions::limits

    fn ParseOptions::limits(self : ParseOptions) -> Limits

    ParseOptions::strict

    fn ParseOptions::strict(self : ParseOptions) -> Bool

    ParseReport

    pub struct ParseReport {
    document : SessionDescription
    warnings : Array[SdpError]
    }

    A parser result bundles the document with non-fatal compatibility notices.

    ParseReport::document

    ParseReport::warning_count

    fn ParseReport::warning_count(self : ParseReport) -> Int

    ParseReport::warnings

    fn ParseReport::warnings(self : ParseReport) -> Array[SdpError]

    RtpMap

    pub struct RtpMap {
    payload_type : Int
    encoding_name : String
    clock_rate : Int
    encoding_parameters : String?
    }

    A typed RTP payload mapping from a=rtpmap.

    RtpMap::clock_rate

    fn RtpMap::clock_rate(self : RtpMap) -> Int

    RtpMap::encoding_name

    fn RtpMap::encoding_name(self : RtpMap) -> String

    RtpMap::encoding_parameters

    fn RtpMap::encoding_parameters(self : RtpMap) -> String?

    RtpMap::payload_type

    fn RtpMap::payload_type(self : RtpMap) -> Int

    SdpError

    pub struct SdpError {
    stage : String
    kind : String
    line : Int
    column : Int
    context : String
    message : String
    }

    Stable structured error model. Context strings never include raw input.

    SdpError::column

    fn SdpError::column(self : SdpError) -> Int

    SdpError::context

    fn SdpError::context(self : SdpError) -> String

    SdpError::kind

    fn SdpError::kind(self : SdpError) -> String

    SdpError::line

    fn SdpError::line(self : SdpError) -> Int

    SdpError::message

    fn SdpError::message(self : SdpError) -> String

    SdpError::stage

    fn SdpError::stage(self : SdpError) -> String

    SdpError::to_display

    fn SdpError::to_display(self : SdpError) -> String

    SdpLine

    pub struct SdpLine {
    kind : String
    value : String
    line : Int
    }

    A source line retained for diagnostics and preserve-mode writing.

    SdpLine::kind

    fn SdpLine::kind(self : SdpLine) -> String

    SdpLine::line

    fn SdpLine::line(self : SdpLine) -> Int

    SdpLine::value

    fn SdpLine::value(self : SdpLine) -> String

    SessionDescription

    pub struct SessionDescription {
    version : Int
    origin : Origin?
    session_name : String
    information : String?
    uri : String?
    emails : Array[String]
    phones : Array[String]
    connection : Connection?
    bandwidths : Array[Bandwidth]
    timings : Array[Timing]
    timezone_adjustments : String?
    encryption_key : String?
    attributes : Array[Attribute]
    media_descriptions : Array[MediaDescription]
    source_lines : Array[SdpLine]
    raw_source : String
    }

    A complete SDP document.

    SessionDescription::attributes

    SessionDescription::attributes_named

    fn SessionDescription::attributes_named(self : SessionDescription, name : String) -> Array[Attribute]

    Returns all session-level attributes with the requested case-insensitive name.

    SessionDescription::bandwidths

    SessionDescription::connection

    SessionDescription::emails

    fn SessionDescription::emails(self : SessionDescription) -> Array[String]

    SessionDescription::encryption_key

    fn SessionDescription::encryption_key(self : SessionDescription) -> String?

    SessionDescription::information

    fn SessionDescription::information(self : SessionDescription) -> String?

    SessionDescription::media_count

    fn SessionDescription::media_count(self : SessionDescription) -> Int

    SessionDescription::media_descriptions

    fn SessionDescription::media_descriptions(self : SessionDescription) -> Array[MediaDescription]

    SessionDescription::origin

    SessionDescription::phones

    fn SessionDescription::phones(self : SessionDescription) -> Array[String]

    SessionDescription::raw_source

    fn SessionDescription::raw_source(self : SessionDescription) -> String

    SessionDescription::session_name

    fn SessionDescription::session_name(self : SessionDescription) -> String

    SessionDescription::source_lines

    fn SessionDescription::source_lines(self : SessionDescription) -> Array[SdpLine]

    SessionDescription::timezone_adjustments

    fn SessionDescription::timezone_adjustments(self : SessionDescription) -> String?

    SessionDescription::timings

    SessionDescription::to_debug_string

    fn SessionDescription::to_debug_string(self : SessionDescription) -> String

    Returns a compact deterministic diagnostic representation.

    SessionDescription::uri

    fn SessionDescription::uri(self : SessionDescription) -> String?

    SessionDescription::version

    fn SessionDescription::version(self : SessionDescription) -> Int

    SessionStats

    pub struct SessionStats {
    media_count : Int
    active_media_count : Int
    rejected_media_count : Int
    session_attribute_count : Int
    media_attribute_count : Int
    rtp_payload_count : Int
    connection_count : Int
    bandwidth_count : Int
    timing_count : Int
    unknown_attribute_count : Int
    }

    Query, statistics, engineering audit and RFC 3264 offer/answer analysis.

    SessionStats::active_media_count

    fn SessionStats::active_media_count(self : SessionStats) -> Int

    SessionStats::bandwidth_count

    fn SessionStats::bandwidth_count(self : SessionStats) -> Int

    SessionStats::connection_count

    fn SessionStats::connection_count(self : SessionStats) -> Int

    SessionStats::media_attribute_count

    fn SessionStats::media_attribute_count(self : SessionStats) -> Int

    SessionStats::media_count

    fn SessionStats::media_count(self : SessionStats) -> Int

    SessionStats::rejected_media_count

    fn SessionStats::rejected_media_count(self : SessionStats) -> Int

    SessionStats::rtp_payload_count

    fn SessionStats::rtp_payload_count(self : SessionStats) -> Int

    SessionStats::session_attribute_count

    fn SessionStats::session_attribute_count(self : SessionStats) -> Int

    SessionStats::timing_count

    fn SessionStats::timing_count(self : SessionStats) -> Int

    SessionStats::to_text

    fn SessionStats::to_text(self : SessionStats) -> String

    SessionStats::unknown_attribute_count

    fn SessionStats::unknown_attribute_count(self : SessionStats) -> Int

    Timing

    pub struct Timing {
    start : String
    stop : String
    repeats : Array[String]
    }

    A t= time field and its associated r= repeat fields.

    Timing::repeats

    fn Timing::repeats(self : Timing) -> Array[String]

    Timing::start

    fn Timing::start(self : Timing) -> String

    Timing::stop

    fn Timing::stop(self : Timing) -> String

    ValidationIssue

    pub struct ValidationIssue {
    severity : IssueSeverity
    code : String
    line : Int
    scope : String
    message : String
    reference : String
    }

    ValidationIssue::code

    fn ValidationIssue::code(self : ValidationIssue) -> String

    ValidationIssue::line

    fn ValidationIssue::line(self : ValidationIssue) -> Int

    ValidationIssue::message

    fn ValidationIssue::message(self : ValidationIssue) -> String

    ValidationIssue::reference

    fn ValidationIssue::reference(self : ValidationIssue) -> String

    ValidationIssue::scope

    fn ValidationIssue::scope(self : ValidationIssue) -> String

    ValidationIssue::severity

    ValidationReport

    pub struct ValidationReport {
    issues : Array[ValidationIssue]
    }

    ValidationReport::error_count

    fn ValidationReport::error_count(self : ValidationReport) -> Int

    ValidationReport::has_code

    fn ValidationReport::has_code(self : ValidationReport, code : String) -> Bool

    ValidationReport::info_count

    fn ValidationReport::info_count(self : ValidationReport) -> Int

    ValidationReport::is_valid

    fn ValidationReport::is_valid(self : ValidationReport) -> Bool

    ValidationReport::issue_count

    fn ValidationReport::issue_count(self : ValidationReport) -> Int

    ValidationReport::issues

    ValidationReport::to_text

    fn ValidationReport::to_text(self : ValidationReport) -> String

    A deterministic human-readable validation report.

    ValidationReport::warning_count

    fn ValidationReport::warning_count(self : ValidationReport) -> Int

    active_media

    fn active_media(document : SessionDescription) -> Array[MediaDescription]

    Returns every non-rejected media description.

    analyze_offer_answer

    fn analyze_offer_answer(offer : SessionDescription, answer : SessionDescription) -> OfferAnswerReport

    Performs RFC 3264 structural offer/answer checks without network behavior.

    attribute

    fn attribute(name : String, value : String?, line : Int) -> Attribute

    Constructs an attribute value.

    attribute_payload

    fn attribute_payload(item : Attribute) -> Int?

    Parses an attribute whose value starts with a numeric payload identifier.

    audit

    fn audit(document : SessionDescription) -> AuditReport

    Performs operational checks that are deliberately stricter than RFC 8866.

    bandwidth

    fn bandwidth(modifier : String, value : Int) -> Bandwidth

    Constructs a bandwidth value.

    canonical_is_idempotent

    fn canonical_is_idempotent(input : String) -> Bool

    Checks canonical idempotence without relying on array equality.

    canonicalize

    fn canonicalize(input : String) -> Result[String, SdpError]

    Parses and canonicalizes in one operation.

    codec_names

    fn codec_names(document : SessionDescription) -> Array[String]

    Returns the distinct codec names advertised by all valid rtpmap lines.

    compatible_options

    fn compatible_options() -> ParseOptions

    connection

    fn connection(network_type : String, address_type : String, connection_address : String, ttl : Int?, address_count : Int?) -> Connection

    Constructs a connection value.

    default_limits

    fn default_limits() -> Limits

    effective_attribute

    fn effective_attribute(document : SessionDescription, media : MediaDescription, name : String) -> String?

    Returns the effective value of a single-valued attribute.

    effective_connection

    fn effective_connection(document : SessionDescription, media : MediaDescription) -> Connection?

    Returns the effective connection, applying the RFC 8866 session default.

    empty_session

    fn empty_session(raw_source : String) -> SessionDescription

    Constructs an empty session for generators and the parser.

    format_parameters

    fn format_parameters(format : String, parameters : String) -> FormatParameters

    Constructs a typed format-parameter mapping.

    is_registered_attribute

    fn is_registered_attribute(value : String) -> Bool

    is_registered_bandwidth

    fn is_registered_bandwidth(value : String) -> Bool

    is_registered_media

    fn is_registered_media(value : String) -> Bool

    is_registered_protocol

    fn is_registered_protocol(value : String) -> Bool

    is_rtp_protocol

    fn is_rtp_protocol(value : String) -> Bool

    library_version

    fn library_version() -> String

    The library version. Keep this value aligned with moon.mod.

    limits

    fn limits(max_input_bytes : Int, max_lines : Int, max_line_bytes : Int, max_media : Int, max_attributes : Int, max_formats_per_media : Int, max_timings : Int, max_repeats_per_timing : Int) -> Limits

    media_by_mid

    fn media_by_mid(document : SessionDescription, mid : String) -> MediaDescription?

    Finds a media description by its a=mid value.

    media_by_type

    fn media_by_type(document : SessionDescription, media_type : String) -> Array[MediaDescription]

    Returns every media description with a matching media token.

    media_description

    fn media_description(media : String, port : Int, port_count : Int, protocol : String, formats : Array[String]) -> MediaDescription

    Constructs an empty media description with its m= tuple.

    origin

    fn origin(username : String, session_id : String, session_version : String, network_type : String, address_type : String, unicast_address : String) -> Origin

    Constructs an origin value.

    parse

    fn parse(input : String) -> Result[SessionDescription, SdpError]

    Parses SDP using compatibility defaults while preserving every source line.

    parse_and_validate

    fn parse_and_validate(input : String) -> Result[ValidationReport, SdpError]

    Parses and validates, returning parse errors separately from diagnostics.

    parse_fmtp

    fn parse_fmtp(item : Attribute) -> Result[FormatParameters, SdpError]

    Parses an a=fmtp:<format> <parameters> attribute.

    parse_options

    fn parse_options(strict : Bool, allow_lf : Bool, allow_obsolete_key : Bool, limits : Limits) -> ParseOptions

    parse_report

    fn parse_report(document : SessionDescription, warnings : Array[SdpError]) -> ParseReport

    parse_rtpmap

    fn parse_rtpmap(item : Attribute) -> Result[RtpMap, SdpError]

    Parses an a=rtpmap:<payload> <encoding>/<clock>[/<channels>] attribute.

    parse_strict

    fn parse_strict(input : String) -> Result[SessionDescription, SdpError]

    Parses SDP using the strict RFC line-ending and obsolete-key policy.

    parse_with_options

    fn parse_with_options(input : String, options : ParseOptions) -> Result[ParseReport, SdpError]

    Parses SDP with caller-selected limits and compatibility policy.

    permissive_limits

    fn permissive_limits() -> Limits

    registered_address_types

    fn registered_address_types() -> Array[String]

    registered_attribute_names

    fn registered_attribute_names() -> Array[String]

    registered_bandwidth_types

    fn registered_bandwidth_types() -> Array[String]

    registered_media_types

    fn registered_media_types() -> Array[String]

    registered_network_types

    fn registered_network_types() -> Array[String]

    registered_protocols

    fn registered_protocols() -> Array[String]

    registry_snapshot_date

    fn registry_snapshot_date() -> String

    Offline snapshot of the core IANA SDP Parameters registries.

    The snapshot intentionally contains only names needed for deterministic recognition. Runtime parsing never downloads or resolves anything.

    rtp_map

    fn rtp_map(payload_type : Int, encoding_name : String, clock_rate : Int, encoding_parameters : String?) -> RtpMap

    Constructs a typed RTP mapping.

    run_cli

    fn run_cli(args : Array[String]) -> String

    Runs a CLI command. All outputs are one-line JSON and no branch raises.

    sdp_error

    fn sdp_error(stage : String, kind : String, line : Int, column : Int, context : String, message : String) -> SdpError

    sdp_line

    fn sdp_line(kind : String, value : String, line : Int) -> SdpLine

    Constructs a retained source line.

    static_rtp_payload_name

    fn static_rtp_payload_name(payload : Int) -> String?

    statistics

    fn statistics(document : SessionDescription) -> SessionStats

    Computes structural statistics without altering the document.

    strict_limits

    fn strict_limits() -> Limits

    strict_options

    fn strict_options() -> ParseOptions

    timing

    fn timing(start : String, stop : String) -> Timing

    Constructs a timing value.

    validate

    fn validate(document : SessionDescription) -> ValidationReport

    Performs syntax-independent RFC and registry validation.

    write_canonical

    fn write_canonical(document : SessionDescription) -> Result[String, SdpError]

    Emits a deterministic CRLF document in RFC 8866 field order.

    write_preserve

    fn write_preserve(document : SessionDescription) -> String

    Re-emits the exact source bytes supplied to the parser.

    Powered by MoonBit

    Site sourceReport issueModulesSkillsBuild queueStatistics

    © 2026 mooncakes.io