pub fn usp_session_context_record<'a>(
    version: &'a str,
    to_id: &'a str,
    from_id: &'a str,
    payload_security: PayloadSecurity,
    mac_signature: &'a [u8],
    sender_cert: &'a [u8],
    session_id: u64,
    sequence_id: u64,
    expected_id: u64,
    retransmit_id: u64,
    payload_sar_state: PayloadSARState,
    payloadrec_sar_state: PayloadSARState,
    msg: &'a [u8]
) -> Record<'a>
Expand description

Wraps a Usp Msg into an “session_context” USP Record with the specified record information

§Arguments

  • version - The USP version of the record
  • to_id - The USP Endpoint ID of the receiver
  • from_id - The USP Endpoint ID of the sender
  • payload_security - An enumeration of type PayloadSecurity
  • mac_signature - Message authentication code or signature used to ensure the integrity of the non-payload fields, when integrity protection of non-payload fields is performed
  • sender_cert - PEM encoded certificate used to provide the signature in the mac_signature field, when the payload security mechanism does not provide the mechanism to do so
  • session_id - The ID of the context session
  • sequence_id - The sequence number within the context session
  • expected_id - The expected next sequence number within the context session
  • retransmit_id - The sequence number of the part which is being retransmitted
  • msg - The ProtoBuf encoded USP Msg

§Example

use rusp::usp_generator::{usp_session_context_record, PayloadSARState};
use rusp::usp_types::PayloadSecurity;
let newrecord = usp_session_context_record(
    "1.1",
    "proto::myfancyrecipient",
    "proto::anonymous",
    PayloadSecurity::PLAINTEXT,
    &[],
    &[],
    1234,
    1,
    2,
    0,
    PayloadSARState::NONE,
    PayloadSARState::NONE,
    &[],
);