nsmcp::AccessDiagnosticTool method options (protected)

 <instance of nsmcp::AccessDiagnosticTool[i]> options arguments

Defined in /usr/local/ns/tcl/nsmcp/traffic-tools.tcl

Parameters:
arguments (required)

Testcases:
No testcase defined.
Source code:
if {[lindex $arguments 1] ne "object"} {error "Expected an arguments object"}
set options {lastMinutes 60 limit 20 pool bots module nslog includePeerAddresses false category {} scanStrategy window aggregateTraffic false}
dict set options mode [expr {${:operation} eq "bot" ? ${:defaultMode} : "page"}]
set seen {}
foreach {key type value} [lindex $arguments 2] {
    if {$key in $seen} {error "Duplicate argument: $key"}
    lappend seen $key
    switch -- $key {
        lastMinutes - limit - beforeOffset - sourceBytes {
            if {$type ne "number" || ![string is entier -strict $value] || $value<0} {error "Invalid $key"}
            if {$key eq "lastMinutes" && ($value<1 || $value>1440)} {error "lastMinutes must be 1..1440"}
            if {$key eq "limit" && ($value<1 || $value>100)} {error "limit must be 1..100"}
        }
        from - to {
            if {$type ne "number" || ![string is double -strict $value] || $value<0 || $value>[clock seconds]} {error "Invalid $key"}
        }
        pool - module {
            if {$type ne "string" || ![regexp {^[A-Za-z0-9_.-]+$} $value]} {error "Invalid $key"}
        }
        mode {
            if {$type ne "string" || $value ni {scan page} || (${:operation} ne "bot" && $value ne "page")} {error "Invalid diagnostic mode"}
        }
        scanStrategy {
            if {$type ne "string" || $value ni {window full}} {error "Invalid scanStrategy"}
        }
        category {
            if {${:operation} ne "bot" || $type ne "string" || $value ni {
                matching-rule-in-target matching-rule-other-pool-candidate
                bot-like-unmatched-heuristic no-target-rule-match unknown
                native-target-in-target native-target-other-pool-candidate
                bot-like-routed-elsewhere-heuristic native-other-pool
            }} {error "Invalid routing category"}
        }
        sourceIdentity - mappingIdentity {
            if {$type ne "string" || ![regexp {^[a-f0-9]{64}$} $value]} {error "Invalid $key"}
        }
        authenticationState {
            if {$type ne "string" || $value ni {anonymous authenticated unknown}} {error "Invalid authenticationState"}
        }
        path {
            if {$type ne "string" || ![string match /* $value] || [string length $value]>2048 || [string first ? $value]>=0 || [string first \x00 $value]>=0} {error "Expected exact queryless path"}
        }
        aggregateTraffic - includePeerAddresses {if {$type ne "boolean"} {error "Expected a boolean"}}
        default {error "Unknown argument: $key"}
    }
    dict set options $key $value
}
if {[dict exists $options from] != [dict exists $options to]} {error "Specify both from and to"}
if {[dict exists $options from]} {
    if {"lastMinutes" in $seen || [dict get $options to]<=[dict get $options from] || [dict get $options to]-[dict get $options from]>86400} {error "Invalid or conflicting time selectors"}
} else {
    dict set options to [clock seconds]
    dict set options from [expr {[dict get $options to]-60*[dict get $options lastMinutes]}]
}
set paging 0
foreach key {beforeOffset sourceBytes sourceIdentity} {incr paging [dict exists $options $key]}
if {$paging ni {0 3}} {error "Paging requires beforeOffset, sourceBytes and sourceIdentity"}
if {$paging && [dict get $options beforeOffset]>[dict get $options sourceBytes]} {error "Invalid cursor"}
return $options
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: