Moving micasa 1.5 trunk to Novell forge.
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
//////////////////////////////////////////////////
|
||||
// Created by Ivan Latunov - IvanWeb.com //
|
||||
//----------------------------------------------//
|
||||
// This program is free software. You can //
|
||||
// redistribute it and/or modify it as you wish //
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
namespace sscs.communication.win.InterProcessComm {
|
||||
#region Comments
|
||||
/// <summary>
|
||||
/// Interface, which defines methods for a Channel Manager class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A Channel Manager is responsible for creating and maintaining channels for inter-process communication. The opened channels are meant to be reusable for performance optimization. Each channel needs to procees requests by calling the <see cref="AppModule.InterProcessComm.IChannelManager.HandleRequest">HandleRequest</see> method of the Channel Manager.
|
||||
/// </remarks>
|
||||
#endregion
|
||||
public interface IChannelManager {
|
||||
#region Comments
|
||||
/// <summary>
|
||||
/// Initializes the Channel Manager.
|
||||
/// </summary>
|
||||
#endregion
|
||||
void Initialize();
|
||||
#region Comments
|
||||
/// <summary>
|
||||
/// Closes all opened channels and stops the Channel Manager.
|
||||
/// </summary>
|
||||
#endregion
|
||||
void Start();
|
||||
|
||||
void Stop();
|
||||
#region Comments
|
||||
/// <summary>
|
||||
/// Handles a request.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method currently caters for text based requests. XML strings can be used in case complex request structures are needed.
|
||||
/// </remarks>
|
||||
/// <param name="request">The incoming request.</param>
|
||||
/// <returns>The resulting response.</returns>
|
||||
#endregion
|
||||
string HandleRequest(string request);
|
||||
#region Comments
|
||||
/// <summary>
|
||||
/// Indicates whether the Channel Manager is in listening mode.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This property is left public so that other classes, like a server channel can start or stop listening based on the Channel Manager mode.
|
||||
/// </remarks>
|
||||
#endregion
|
||||
bool Listen {get; set;}
|
||||
#region Comments
|
||||
/// <summary>
|
||||
/// Forces the Channel Manager to exit a sleeping mode and create a new channel.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Normally the Channel Manager will create a number of reusable channels, which will handle the incoming reqiests, and go into a sleeping mode. However if the request load is high, the Channel Manager needs to be asked to create additional channels.
|
||||
/// </remarks>
|
||||
#endregion
|
||||
void WakeUp();
|
||||
#region Comments
|
||||
/// <summary>
|
||||
/// Removes an existing channel.
|
||||
/// </summary>
|
||||
/// <param name="param">A parameter identifying the channel.</param>
|
||||
#endregion
|
||||
void RemoveServerChannel(object param);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
//////////////////////////////////////////////////
|
||||
// Created by Ivan Latunov - IvanWeb.com //
|
||||
//----------------------------------------------//
|
||||
// This program is free software. You can //
|
||||
// redistribute it and/or modify it as you wish //
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace sscs.communication.win.InterProcessComm {
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
public interface IClientChannel : IDisposable {
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
#endregion
|
||||
string HandleRequest(string request);
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
#endregion
|
||||
string HandleRequest(Stream request);
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
#endregion
|
||||
object HandleRequest(object request);
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
#endregion
|
||||
IClientChannel Create();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
//////////////////////////////////////////////////
|
||||
// Created by Ivan Latunov - IvanWeb.com //
|
||||
//----------------------------------------------//
|
||||
// This program is free software. You can //
|
||||
// redistribute it and/or modify it as you wish //
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
namespace sscs.communication.win.InterProcessComm {
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
public interface IInterProcessConnection : IDisposable {
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
int NativeHandle{get;}
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
void Connect();
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
void Close();
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
#endregion
|
||||
string Read();
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
#endregion
|
||||
byte[] ReadBytes();
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
#endregion
|
||||
void Write(string text);
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="bytes"></param>
|
||||
#endregion
|
||||
void WriteBytes(byte[] bytes);
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
#endregion
|
||||
InterProcessConnectionState GetState();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
//////////////////////////////////////////////////
|
||||
// Created by Ivan Latunov - IvanWeb.com //
|
||||
//----------------------------------------------//
|
||||
// This program is free software. You can //
|
||||
// redistribute it and/or modify it as you wish //
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
namespace sscs.communication.win.InterProcessComm {
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
public enum InterProcessConnectionState {
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
NotSet = 0,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
Error = 1,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
Creating = 2,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
Created = 3,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
WaitingForClient = 4,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
ConnectedToClient = 5,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
ConnectingToServer = 6,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
ConnectedToServer = 7,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
Reading = 8,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
ReadData = 9,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
Writing = 10,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
WroteData = 11,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
Flushing = 12,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
FlushedData = 13,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
Disconnecting = 14,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
Disconnected = 15,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
Closing = 16,
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
Closed = 17,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
//////////////////////////////////////////////////
|
||||
// Created by Ivan Latunov - IvanWeb.com //
|
||||
//----------------------------------------------//
|
||||
// This program is free software. You can //
|
||||
// redistribute it and/or modify it as you wish //
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace sscs.communication.win.InterProcessComm {
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
public class InterProcessIOException : Exception {
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
public bool IsServerAvailable = true;
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#endregion
|
||||
public uint ErrorCode = 0;
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
#endregion
|
||||
public InterProcessIOException(String text) : base(text) {
|
||||
}
|
||||
#region Comments
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="context"></param>
|
||||
#endregion
|
||||
protected InterProcessIOException(SerializationInfo info, StreamingContext context) : base(info, context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user