1
0
mirror of https://bitbucket.org/anguist/ntpa synced 2025-10-06 11:04:40 +00:00

Removed deprecated files

This commit is contained in:
Carsten
2016-04-16 19:46:11 +02:00
parent e4b2b86421
commit bf00c69621
5 changed files with 0 additions and 498 deletions

View File

@ -1,79 +0,0 @@
//
// Main.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// Copyright (c) 2013-2016 Carsten Sonne Larsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Text;
using Ntp.Analyzer.Log;
using Ntp.Analyzer.Process;
using Ntp.Process;
using Ntp.System;
namespace Ntp.Analyzer.Cli
{
/// <summary>
/// Entry point for CLI application.
/// </summary>
public static class MainClass
{
/// <summary>
/// The entry point of the program, where the program control starts and ends.
/// </summary>
/// <param name="args">The command-line arguments.</param>
public static void Main (string[] args)
{
if (args.Length > 2) {
ShowUsage ();
return;
}
if (args.Length >= 1 && args[0] == "help") {
ShowUsage ();
return;
}
string name = (args.Length > 1) ? args [1] : "NTPA_DEF";
if (args.Length >= 1 && args [0] == "stop") {
bool success = InterLock.Release (name, new ActivityLog ());
if (!success) {
Console.WriteLine ("Could not stop daemon.");
}
return;
}
string configFile = (args.Length > 0) ? args [0] : "/etc/ntpa.conf";
int pid = ProcessInfo.ProcessId;
Main main = new Main (configFile, pid, name);
main.Start ();
}
private static void ShowUsage()
{
Console.WriteLine("NTP Analyzer Daemon.");
Console.WriteLine("Usage: ntpa [configuration file | stop] [instance name]");
}
}
}

View File

@ -1,52 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9790FACF-170E-43C7-889A-D4445FC7E7A1}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Ntp.Analyzer.Config.Validate.Cli</RootNamespace>
<AssemblyName>ntpav</AssemblyName>
<ReleaseVersion>8.4.2</ReleaseVersion>
<StartupObject>Ntp.Analyzer.Config.Validate.Cli.Program</StartupObject>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Externalconsole>true</Externalconsole>
<Commandlineparameters>/home/hawk/code/ntp/config/ntpa.2.conf</Commandlineparameters>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Externalconsole>true</Externalconsole>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\Ntp.Analyzer\Ntp.Analyzer.csproj">
<Project>{28444C86-1B41-4558-BA27-DCF32B2B1E0F}</Project>
<Name>Ntp.Analyzer</Name>
</ProjectReference>
<ProjectReference Include="..\Ntp.Config\Ntp.Config.csproj">
<Project>{43A1A769-6ED9-4AE1-821A-43F97814968C}</Project>
<Name>Ntp.Config</Name>
</ProjectReference>
</ItemGroup>
</Project>

View File

@ -1,161 +0,0 @@
//
// MonitorClient.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// Copyright (c) 2013 Carsten Sonne Larsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Threading;
using System.Text;
using System.Net;
using System.Net.Sockets;
public class Client {
// used to pass state information to delegate
class StateObject
{
internal byte[] sBuffer;
internal Socket sSocket;
internal StateObject(int size, Socket sock) {
sBuffer = new byte[size];
sSocket = sock;
}
}
static void Main(string[] argHostName)
{
IPAddress ipAddress =
Dns.Resolve( argHostName[0] ).AddressList[0];
IPEndPoint ipEndpoint =
new IPEndPoint(ipAddress, 1800);
Socket clientSocket = new Socket(
AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
IAsyncResult asyncConnect = clientSocket.BeginConnect(
ipEndpoint,
new AsyncCallback(connectCallback),
clientSocket );
Console.Write("Connection in progress.");
if( writeDot(asyncConnect) == true )
{
// allow time for callbacks to
// finish before the program ends
Thread.Sleep(3000);
}
}
public static void
connectCallback(IAsyncResult asyncConnect) {
Socket clientSocket =
(Socket)asyncConnect.AsyncState;
clientSocket.EndConnect(asyncConnect);
// arriving here means the operation completed
// (asyncConnect.IsCompleted = true) but not
// necessarily successfully
if( clientSocket.Connected == false )
{
Console.WriteLine( ".client is not connected." );
return;
}
else Console.WriteLine( ".client is connected." );
byte[] sendBuffer = Encoding.ASCII.GetBytes("Hello");
IAsyncResult asyncSend = clientSocket.BeginSend(
sendBuffer,
0,
sendBuffer.Length,
SocketFlags.None,
new AsyncCallback(sendCallback),
clientSocket);
Console.Write("Sending data.");
writeDot(asyncSend);
}
public static void sendCallback(IAsyncResult asyncSend)
{
Socket clientSocket = (Socket)asyncSend.AsyncState;
int bytesSent = clientSocket.EndSend(asyncSend);
Console.WriteLine(
".{0} bytes sent.",
bytesSent.ToString() );
StateObject stateObject =
new StateObject(16, clientSocket);
// this call passes the StateObject because it
// needs to pass the buffer as well as the socket
IAsyncResult asyncReceive =
clientSocket.BeginReceive(
stateObject.sBuffer,
0,
stateObject.sBuffer.Length,
SocketFlags.None,
new AsyncCallback(receiveCallback),
stateObject);
Console.Write("Receiving response.");
writeDot(asyncReceive);
}
public static void
receiveCallback(IAsyncResult asyncReceive) {
StateObject stateObject =
(StateObject)asyncReceive.AsyncState;
int bytesReceived =
stateObject.sSocket.EndReceive(asyncReceive);
Console.WriteLine(
".{0} bytes received: {1}{2}{2}Shutting down.",
bytesReceived.ToString(),
Encoding.ASCII.GetString(stateObject.sBuffer),
Environment.NewLine );
stateObject.sSocket.Shutdown(SocketShutdown.Both);
stateObject.sSocket.Close();
}
// times out after 2 seconds but operation continues
internal static bool writeDot(IAsyncResult ar)
{
int i = 0;
while( ar.IsCompleted == false )
{
if( i++ > 20 )
{
Console.WriteLine("Timed out.");
return false;
}
Console.Write(".");
Thread.Sleep(100);
}
return true;
}
}

View File

@ -1,169 +0,0 @@
//
// MonitorServer.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// Copyright (c) 2013 Carsten Sonne Larsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Threading;
using System.Text;
using System.Net;
using System.Net.Sockets;
public class Server
{
// used to pass state information to delegate
internal class StateObject
{
internal byte[] sBuffer;
internal Socket sSocket;
internal StateObject(int size, Socket sock) {
sBuffer = new byte[size];
sSocket = sock;
}
}
static void Main()
{
IPAddress ipAddress =
Dns.Resolve( Dns.GetHostName() ).AddressList[0];
IPEndPoint ipEndpoint =
new IPEndPoint(ipAddress, 1800);
Socket listenSocket =
new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
listenSocket.Bind(ipEndpoint);
listenSocket.Listen(1);
IAsyncResult asyncAccept = listenSocket.BeginAccept(
new AsyncCallback(Server.acceptCallback),
listenSocket );
// could call listenSocket.EndAccept(asyncAccept) here
// instead of in the callback method, but since
// EndAccept blocks, the behavior would be similar to
// calling the synchronous Accept method
Console.Write("Connection in progress.");
if( writeDot(asyncAccept) == true )
{
// allow time for callbacks to
// finish before the program ends
Thread.Sleep(3000);
}
}
public static void
acceptCallback(IAsyncResult asyncAccept) {
Socket listenSocket = (Socket)asyncAccept.AsyncState;
Socket serverSocket =
listenSocket.EndAccept(asyncAccept);
// arriving here means the operation completed
// (asyncAccept.IsCompleted = true) but not
// necessarily successfully
if( serverSocket.Connected == false )
{
Console.WriteLine( ".server is not connected." );
return;
}
else Console.WriteLine( ".server is connected." );
listenSocket.Close();
StateObject stateObject =
new StateObject(16, serverSocket);
// this call passes the StateObject because it
// needs to pass the buffer as well as the socket
IAsyncResult asyncReceive =
serverSocket.BeginReceive(
stateObject.sBuffer,
0,
stateObject.sBuffer.Length,
SocketFlags.None,
new AsyncCallback(receiveCallback),
stateObject);
Console.Write("Receiving data.");
writeDot(asyncReceive);
}
public static void
receiveCallback(IAsyncResult asyncReceive) {
StateObject stateObject =
(StateObject)asyncReceive.AsyncState;
int bytesReceived =
stateObject.sSocket.EndReceive(asyncReceive);
Console.WriteLine(
".{0} bytes received: {1}",
bytesReceived.ToString(),
Encoding.ASCII.GetString(stateObject.sBuffer) );
byte[] sendBuffer =
Encoding.ASCII.GetBytes("Goodbye");
IAsyncResult asyncSend =
stateObject.sSocket.BeginSend(
sendBuffer,
0,
sendBuffer.Length,
SocketFlags.None,
new AsyncCallback(sendCallback),
stateObject.sSocket);
Console.Write("Sending response.");
writeDot(asyncSend);
}
public static void sendCallback(IAsyncResult asyncSend) {
Socket serverSocket = (Socket)asyncSend.AsyncState;
int bytesSent = serverSocket.EndSend(asyncSend);
Console.WriteLine(
".{0} bytes sent.{1}{1}Shutting down.",
bytesSent.ToString(),
Environment.NewLine );
serverSocket.Shutdown(SocketShutdown.Both);
serverSocket.Close();
}
// times out after 20 seconds but operation continues
internal static bool writeDot(IAsyncResult ar)
{
int i = 0;
while( ar.IsCompleted == false )
{
if( i++ > 40 )
{
Console.WriteLine("Timed out.");
return false;
}
Console.Write(".");
Thread.Sleep(500);
}
return true;
}
}

View File

@ -1,37 +0,0 @@
//
// MyClass.cs
//
// Author:
// hawk <>
//
// Copyright (c) 2013 hawk
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Ntp.Monitor
{
public class MyClass
{
public MyClass ()
{
}
}
}