MCPcopy Create free account
hub / github.com/PowerShell/DSC / profiles_to_mask

Function profiles_to_mask

resources/windows_firewall/src/firewall.rs:198–214  ·  view source on GitHub ↗
(values: &[String])

Source from the content-addressed store, hash-verified

196}
197
198fn profiles_to_mask(values: &[String]) -> Result<i32, FirewallError> {
199 if values.is_empty() {
200 return Ok(NET_FW_PROFILE2_ALL.0);
201 }
202
203 let mut mask = 0;
204 for value in values {
205 match value.to_ascii_lowercase().as_str() {
206 "all" => return Ok(NET_FW_PROFILE2_ALL.0),
207 "domain" => mask |= NET_FW_PROFILE2_DOMAIN.0,
208 "private" => mask |= NET_FW_PROFILE2_PRIVATE.0,
209 "public" => mask |= NET_FW_PROFILE2_PUBLIC.0,
210 _ => return Err(t!("firewall.invalidProfiles", value = value).to_string().into()),
211 }
212 }
213 Ok(mask)
214}
215
216fn split_csv(value: Option<String>) -> Option<Vec<String>> {
217 value.map(|raw| {

Callers 1

apply_rule_propertiesFunction · 0.85

Calls 2

as_strMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected