Skip to content

Commit

Permalink
Merge pull request #627 from Enet4/imp/tools/max-pdu-length-check
Browse files Browse the repository at this point in the history
[findscu][scpproxy][storescp][storescu] Pre-validate max PDU length option
  • Loading branch information
Enet4 authored Jan 11, 2025
2 parents 4a6567c + 17f68a9 commit 17e26a0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
6 changes: 5 additions & 1 deletion findscu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ struct App {
#[arg(long = "called-ae-title")]
called_ae_title: Option<String>,
/// the maximum PDU length
#[arg(long = "max-pdu-length", default_value = "16384")]
#[arg(
long = "max-pdu-length",
default_value = "16384",
value_parser(clap::value_parser!(u32).range(4096..=131_072))
)]
max_pdu_length: u32,

/// use patient root information model
Expand Down
2 changes: 1 addition & 1 deletion scpproxy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ fn command() -> Command {
.help("Maximum PDU length")
.short('m')
.long("max-pdu-length")
.value_parser(value_parser!(u32).range(4096..))
.value_parser(value_parser!(u32).range(4096..=131_072))
.default_value("16384"),
)
}
Expand Down
7 changes: 6 additions & 1 deletion storescp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ struct App {
#[arg(long)]
promiscuous: bool,
/// Maximum PDU length
#[arg(short = 'm', long = "max-pdu-length", default_value = "16384")]
#[arg(
short = 'm',
long = "max-pdu-length",
default_value = "16384",
value_parser(clap::value_parser!(u32).range(4096..=131_072))
)]
max_pdu_length: u32,
/// Output directory for incoming objects
#[arg(short = 'o', default_value = ".")]
Expand Down
6 changes: 5 additions & 1 deletion storescu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ struct App {
#[arg(long = "called-ae-title")]
called_ae_title: Option<String>,
/// the maximum PDU length accepted by the SCU
#[arg(long = "max-pdu-length", default_value = "16384")]
#[arg(
long = "max-pdu-length",
default_value = "16384",
value_parser(clap::value_parser!(u32).range(4096..=131_072))
)]
max_pdu_length: u32,
/// fail if not all DICOM files can be transferred
#[arg(long = "fail-first")]
Expand Down

0 comments on commit 17e26a0

Please sign in to comment.