Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ClearCounter.cs
1using System.Threading.Tasks;
2using System.Xml;
6
8{
13 {
17 public ClearCounter()
18 : base()
19 {
20 }
21
28 public ClearCounter(XmlElement Xml, WafAction Parent, WebApplicationFirewall Document)
29 : base(Xml, Parent, Document)
30 {
31 }
32
36 public override string LocalName => nameof(ClearCounter);
37
45 public override WafAction Create(XmlElement Xml, WafAction Parent, WebApplicationFirewall Document) => new ClearCounter(Xml, Parent, Document);
46
52 public override async Task<WafResult?> Review(ProcessingState State)
53 {
54 CaseInsensitiveString Name = await this.name.EvaluateAsync(State.Variables, string.Empty);
55
56 long Count = await RuntimeCounters.GetCount(Name);
57 await RuntimeCounters.DecrementCounter(Name, Count);
58
59 return null;
60 }
61 }
62}
Represents a case-insensitive string.
Static class managing persistent counters.
static Task< long > DecrementCounter(CaseInsensitiveString Key)
Decrements a counter.
static async Task< long > GetCount(CaseInsensitiveString Key)
Gets the current count of a counter.
override WafAction Create(XmlElement Xml, WafAction Parent, WebApplicationFirewall Document)
Creates a WAF action from its XML definition.
override string LocalName
XML Local Name for the XML element defining the action.
Definition: ClearCounter.cs:36
override async Task< WafResult?> Review(ProcessingState State)
Reviews the processing state, and returns a WAF result, if any.
Definition: ClearCounter.cs:52
ClearCounter(XmlElement Xml, WafAction Parent, WebApplicationFirewall Document)
Clears a named counter.
Definition: ClearCounter.cs:28
Abstract base class for WAF actions with a name.
readonly StringAttribute name
Name attribute
Contains the current state of a review process.
Variables Variables
Set of variables.
Abstract base class for Web Application Firewall actions.
Definition: WafAction.cs:17
WebApplicationFirewall Document
Web Application Firewall document.
Definition: WafAction.cs:60
Web Application Firewall for HttpServer.