Skip to main content

SyncAssociation

Trait SyncAssociation 

Source
pub trait SyncAssociation<S: Read + Write + CloseSocket>: SyncAssociationSealed<S> + Association {
    // Required methods
    fn inner_stream(&mut self) -> &mut S;
    fn get_mut(&mut self) -> (&mut S, &mut BytesMut);

    // Provided methods
    fn send(&mut self, pdu: &Pdu) -> Result<(), Error> { ... }
    fn receive(&mut self) -> Result<Pdu, Error> { ... }
    fn abort(self) -> Result<(), Error>
       where Self: Sized { ... }
    fn release(self) -> Result<(), Error>
       where Self: Sized { ... }
    fn send_pdata(&mut self, presentation_context_id: u8) -> PDataWriter<&mut S>  { ... }
    fn receive_pdata(&mut self) -> PDataReader<'_, &mut S>  { ... }
}
Expand description

Trait that represents methods that can be made on a synchronous association.

Required Methods§

Source

fn inner_stream(&mut self) -> &mut S

Obtain access to the inner stream connected to the association acceptor.

This can be used to send the PDU in semantic fragments of the message, thus using less memory.

Note: reading and writing should be done with care to avoid inconsistencies in the association state. Do not call send and receive while not in a PDU boundary.

Source

fn get_mut(&mut self) -> (&mut S, &mut BytesMut)

Obtain mutable access to the inner stream and read buffer

Provided Methods§

Source

fn send(&mut self, pdu: &Pdu) -> Result<(), Error>

Send a PDU message to the other intervenient.

Source

fn receive(&mut self) -> Result<Pdu, Error>

Read a PDU message from the other intervenient.

Source

fn abort(self) -> Result<(), Error>
where Self: Sized,

Send a provider initiated abort message and shut down the TCP connection, terminating the association.

Source

fn release(self) -> Result<(), Error>
where Self: Sized,

Iniate a graceful release of the association.

A DIMSE A-RELEASE transaction is initiated by this application entity, and the underlying socket is closed once settled.

Note that as of version 0.9.1, implementers of this trait no longer call this method on Drop, so remember to call release explicitly at the end of all DIMSE transactions.

Source

fn send_pdata(&mut self, presentation_context_id: u8) -> PDataWriter<&mut S>

Prepare a P-Data writer for sending one or more data item PDUs.

Returns a writer which automatically splits the inner data into separate PDUs if necessary.

Source

fn receive_pdata(&mut self) -> PDataReader<'_, &mut S>

Prepare a P-Data reader for receiving one or more data item PDUs.

Returns a reader which automatically receives more data PDUs once the bytes collected are consumed.

Implementors§