Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
WafActions.cs
1using System;
2using System.Threading.Tasks;
3using System.Xml;
6
8{
13 public abstract class WafActions : WafAction
14 {
15 private readonly WafAction[] actions;
16
21 public WafActions()
22 : base()
23 {
24 this.actions = Array.Empty<WafAction>();
25 }
26
34 public WafActions(XmlElement Xml, WafAction Parent, WebApplicationFirewall Document)
35 : base(Xml, Parent, Document)
36 {
38
39 foreach (XmlNode N in Xml.ChildNodes)
40 {
41 if (N is XmlElement E)
42 Actions.Add(Parse(E, this, Document));
43 }
44
45 this.actions = Actions.ToArray();
46 }
47
51 public WafAction[] Actions => this.actions;
52
56 public bool IsEmpty => this.actions.Length == 0;
57
61 public override void Prepare()
62 {
63 foreach (WafAction Action in this.actions)
64 Action.Prepare();
65 }
66
72 public async Task<WafResult?> ReviewChildren(ProcessingState State)
73 {
74 foreach (WafAction Action in this.actions)
75 {
76 WafResult? Result = await Action.Review(State);
77 if (Result.HasValue)
78 return Result;
79 }
80
81 return null;
82 }
83 }
84}
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
Contains the current state of a review process.
Abstract base class for Web Application Firewall actions.
Definition: WafAction.cs:17
static WafAction Parse(XmlElement Xml, WafAction Parent, WebApplicationFirewall Document)
Parses an XML Element defining a WAF action.
Definition: WafAction.cs:99
WebApplicationFirewall Document
Web Application Firewall document.
Definition: WafAction.cs:60
Abstract base class for Web Application Firewall actions containing other child actions.
Definition: WafActions.cs:14
WafAction[] Actions
Child actions.
Definition: WafActions.cs:51
async Task< WafResult?> ReviewChildren(ProcessingState State)
Reviews the processing state, and returns a WAF result, if any.
Definition: WafActions.cs:72
WafActions()
Abstract base class for Web Application Firewall actions containing other child actions.
Definition: WafActions.cs:21
WafActions(XmlElement Xml, WafAction Parent, WebApplicationFirewall Document)
Abstract base class for Web Application Firewall actions containing other child actions.
Definition: WafActions.cs:34
bool IsEmpty
If the action contains no child actions.
Definition: WafActions.cs:56
override void Prepare()
Prepares the node for processing.
Definition: WafActions.cs:61
Web Application Firewall for HttpServer.
WafResult
Actions that a Web Server can take after reviewing a request.