Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-04-11 07:32:55 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-04-11 07:32:55 +0300
commit96e1f17aa9e5f7397726fd478f08c229cc727d3c (patch)
tree4df6ff581f4b4229c9d77acfa7135ae2b627e41c /FtpServer/DebugLogHandler.cs
parentbafb7face696afa218eb7105cb814f170c6b54b0 (diff)
FTP server (seriously!) and many fixes
Diffstat (limited to 'FtpServer/DebugLogHandler.cs')
-rw-r--r--FtpServer/DebugLogHandler.cs74
1 files changed, 74 insertions, 0 deletions
diff --git a/FtpServer/DebugLogHandler.cs b/FtpServer/DebugLogHandler.cs
new file mode 100644
index 00000000..292d5eee
--- /dev/null
+++ b/FtpServer/DebugLogHandler.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Net;
+
+namespace mooftpserv
+{
+ /// <summary>
+ /// Default log handler.
+ ///
+ public class DebugLogHandler : ILogHandler
+ {
+ private IPEndPoint peer;
+
+ public DebugLogHandler()
+ {
+ }
+
+ private DebugLogHandler(IPEndPoint peer)
+ {
+ this.peer = peer;
+ }
+
+ public ILogHandler Clone(IPEndPoint peer)
+ {
+ return new DebugLogHandler(peer);
+ }
+
+ private void Write(string format, params object[] args)
+ {
+ Debug.WriteLine(String.Format("{0}: {1}", peer, String.Format(format, args)));
+ }
+
+ public void NewControlConnection()
+ {
+ Write("new control connection");
+ }
+
+ public void ClosedControlConnection()
+ {
+ Write("closed control connection");
+ }
+
+ public void ReceivedCommand(string verb, string arguments)
+ {
+#if VERY_DEBUG
+ string argtext = (arguments == null || arguments == "" ? "" : ' ' + arguments);
+ Write("received command: {0}{1}", verb, argtext);
+#endif
+ }
+
+ public void SentResponse(uint code, string description)
+ {
+#if VERY_DEBUG
+ Write("sent response: {0} {1}", code, description);
+#endif
+ }
+
+ public void NewDataConnection(IPEndPoint remote, IPEndPoint local, bool passive)
+ {
+#if VERY_DEBUG
+ Write("new data connection: {0} <-> {1} ({2})", remote, local, (passive ? "passive" : "active"));
+#endif
+ }
+
+ public void ClosedDataConnection(IPEndPoint remote, IPEndPoint local, bool passive)
+ {
+#if VERY_DEBUG
+ Write("closed data connection: {0} <-> {1} ({2})", remote, local, (passive ? "passive" : "active"));
+#endif
+ }
+ }
+}
+