Exemplo n.º 1
0
        public SyslogServer(int maxQueueLen,
                            int messagesToFlush,
                            int flushInterval,
                            Dictionary <int, string> facilities,
                            Severity minSeverity,
                            IEnumerable <IStorage> storageHandlers,
                            string parserMode)
        {
            this.facilities   = facilities;
            this.messageQueue = new MessageQueue(maxQueueLen, messagesToFlush, flushInterval, storageHandlers);
            this.minSeverity  = minSeverity;
            this.socket       = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            this.socket.Bind(new IPEndPoint(IPAddress.Any, SYSLOG_PORT));
            switch (parserMode.ToLower())
            {
            case "bsd":
                this.syslogParser = new BSDSyslogParser(this.facilities);
                break;

            case "syslog":
                this.syslogParser = new SyslogProtocolParser(this.facilities);
                break;

            default:
                this.syslogParser = new SyslogParser(this.facilities);
                break;
            }
            this.WaitForClient();
        }
Exemplo n.º 2
0
 public SyslogParser(Dictionary <int, string> facilities)
     : base(facilities)
 {
     this.bsdSyslogParser      = new BSDSyslogParser(facilities);
     this.syslogProtocolParser = new SyslogProtocolParser(facilities);
 }