Dimse.Listener (Dimse v0.8.7)

Copy Markdown View Source

Ranch listener lifecycle management.

Wraps :ranch.child_spec/5 to start a TCP listener that accepts DICOM associations. Each accepted connection is handed off to Dimse.ConnectionHandler, which spawns a Dimse.Association GenServer.

Usage

Add to your supervision tree:

children = [
  {Dimse.Listener, port: 11112, handler: MyApp.DicomHandler}
]

Supervisor.start_link(children, strategy: :one_for_one)

Or start dynamically:

{:ok, ref} = Dimse.start_listener(port: 11112, handler: MyApp.DicomHandler)

Options

See Dimse.start_listener/1 for available options.

Summary

Functions

Returns a child spec for the Ranch listener.

Starts a DIMSE listener.

Stops a running listener.

Functions

child_spec(opts)

@spec child_spec(keyword()) :: Supervisor.child_spec()

Returns a child spec for the Ranch listener.

Used when adding the listener to a supervision tree.

start(opts)

@spec start(keyword()) :: {:ok, term()} | {:error, term()}

Starts a DIMSE listener.

Returns {:ok, listener_ref} on success.

Options

  • :port — TCP port (default: 11112)
  • :handler — module implementing Dimse.Handler (required)
  • :ae_title — local AE title (default: "DIMSE")
  • :max_associations — max concurrent associations (default: 200)
  • :num_acceptors — Ranch acceptor pool size (default: 10)
  • :max_pdu_length — max PDU length in bytes (default: 16_384)
  • :ref — custom listener reference (default: auto-generated)
  • :tls — TLS options (keyword list). When present, the listener uses TLS (ranch_ssl) instead of plain TCP. Accepts standard :ssl options:
    • :certfile — path to the server certificate PEM file (required)
    • :keyfile — path to the server private key PEM file (required)
    • :cacertfile — path to CA certificate for client verification
    • :verify — :verify_peer to require client certificates
    • :fail_if_no_peer_cert — true to reject clients without certs PS3.15 Annex B recommends port 2762 for DICOM-TLS.

stop(ref)

@spec stop(term()) :: :ok

Stops a running listener.