Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SyslogEventSinkNode.cs
2using System.Threading.Tasks;
3using System.Xml;
4using Waher.Content;
9using Waher.Things;
12
14{
19 {
24 : base()
25 {
26 }
27
45 string SinkId, string Host, int Port, bool Tls, string Name,
47 : base(Source, Parent, SinkId)
48 {
49 this.Host = Host;
50 this.Port = Port;
51 this.Tls = Tls;
52 this.Name = Name;
53 this.Separation = Separation;
54 }
55
59 [Page(7, "Configuration")]
60 [Header(179, "Host:")]
61 [ToolTip(180, "Host name of recipient.")]
62 [Required]
63 public string Host { get; set; }
64
68 [Page(7, "Configuration")]
69 [Header(161, "Port:")]
70 [ToolTip(181, "Port number of the recipient.")]
71 [Required]
72 public int Port { get; set; }
73
77 [Page(7, "Configuration")]
78 [Header(163, "Use Encryption (TLS)")]
79 [ToolTip(182, "If TLS is used to connect to the recipient.")]
80 public bool Tls { get; set; }
81
85 [Page(7, "Configuration")]
86 [Header(110, "Name:")]
87 [ToolTip(239, "Sender Name as presented to recipient.")]
88 [Required]
89 public string Name { get; set; }
90
94 [Page(7, "Configuration")]
95 [Header(240, "Event Separation:")]
96 [ToolTip(241, "How events are separated in the Syslog stream.")]
97 [Required]
98 [Option(SyslogEventSeparation.OctetCounting, 242, "Octet Counting")]
99 [Option(SyslogEventSeparation.CrLf, 243, "Carriage Return, Line Feed (CRLF)")]
100 [Option(SyslogEventSeparation.Lf, 244, "Only Line Feed (LF)")]
101 [Option(SyslogEventSeparation.Null, 245, "NULL Character")]
103
108 public override Task<string> GetTypeNameAsync(Language Language)
109 {
110 return Language.GetStringAsync(typeof(GatewayConfigSource), 246, "Syslog Event Sink");
111 }
112
119 public override async Task<IEnumerable<Parameter>> GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
120 {
121 LinkedList<Parameter> Parameters = (LinkedList<Parameter>)await base.GetDisplayableParametersAsync(Language, Caller);
123
124 Parameters.AddLast(new StringParameter("Host", await Namespace.GetStringAsync(184, "Host"), this.Host));
125 Parameters.AddLast(new Int32Parameter("PortNumber", await Namespace.GetStringAsync(45, "Port Number"), this.Port));
126 Parameters.AddLast(new BooleanParameter("Encrypted", await Namespace.GetStringAsync(36, "Encrypted"), this.Tls));
127
128 return Parameters;
129 }
130
135 public override void Export(XmlWriter Output)
136 {
137 Output.WriteStartElement("SyslogEventSink");
138 Output.WriteAttributeString("id", this.SinkId);
139 Output.WriteAttributeString("name", this.Name);
140 Output.WriteAttributeString("host", this.Host);
141 Output.WriteAttributeString("port", this.Port.ToString());
142 Output.WriteAttributeString("tls", CommonTypes.Encode(this.Tls));
143 Output.WriteAttributeString("separation", this.Separation.ToString());
144 Output.WriteEndElement();
145 }
146 }
147}
Helps with parsing of commong data types.
Definition: CommonTypes.cs:15
static string Encode(bool x)
Encodes a Boolean for use in XML and other formats.
Definition: CommonTypes.cs:596
Contains information about a language.
Definition: Language.cs:17
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Definition: Language.cs:209
async Task< Namespace > GetNamespaceAsync(string Name)
Gets the namespace object, given its name, if available.
Definition: Language.cs:99
Contains information about a namespace in a language.
Definition: Namespace.cs:17
Task< LanguageString > GetStringAsync(int Id)
Gets the string object, given its ID, if available.
Definition: Namespace.cs:65
Abstract base class for gateway configuration nodes.
virtual INode Parent
Parent Node, or null if a root node.
GatewayConfigSource Source
Source hosting the node.
Abstract base class for event sink nodes.
override void Export(XmlWriter Output)
Exports the event sink definition to XML.
SyslogEventSinkNode(GatewayConfigSource Source, ConfigurationNode Parent, string SinkId, string Host, int Port, bool Tls, string Name, SyslogEventSeparation Separation)
Representation of a SyslogEventSink
override Task< string > GetTypeNameAsync(Language Language)
Gets the type name of the node.
override async Task< IEnumerable< Parameter > > GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
Gets displayable parameters.
Tokens available in request.
Definition: RequestOrigin.cs:9
SyslogEventSeparation
How events are separated in the Syslog event stream.