forked from Raiffeisen-DGTL/ViennaNET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CefSenderFactory.cs
35 lines (33 loc) · 1.03 KB
/
CefSenderFactory.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using ViennaNET.ArcSight.Configuration;
using ViennaNET.ArcSight.Exceptions;
using ViennaNET.Logging;
using SyslogNet.Client.Transport;
namespace ViennaNET.ArcSight
{
/// <inheritdoc />
public class CefSenderFactory : ICefSenderFactory
{
/// <inheritdoc />
public ICefSender CreateSender(ArcSightSection cefConfig)
{
Logger.LogDebug("Call CreateSender...");
ISyslogMessageSender syslogSender;
switch (cefConfig.Protocol)
{
case "tcp":
syslogSender = new SyslogTcpSender(cefConfig.ServerHost, cefConfig.ServerPort);
break;
case "udp":
syslogSender = new SyslogUdpSender(cefConfig.ServerHost, cefConfig.ServerPort);
break;
case "local":
syslogSender = new SyslogLocalSender();
break;
default:
throw new ArcSightConfigurationException($"The syslog protocol {cefConfig.Protocol} has not supported");
}
Logger.LogDebug("Call CreateSender done.");
return new CefSender(syslogSender);
}
}
}