Skip to content

Commit

Permalink
[findscu][scpproxy][storescp][storescu] Pre-validate max PDU length o…
Browse files Browse the repository at this point in the history
…ption
  • Loading branch information
Enet4 committed Jan 11, 2025
1 parent 4a6567c commit df1d1bb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
7 changes: 6 additions & 1 deletion findscu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ 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(
short = 'm',
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 df1d1bb

Please sign in to comment.