using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using SuperSocket.Common; using SuperSocket.SocketBase.Logging; using SuperSocket.SocketBase.Command; using SuperSocket.SocketBase.Config; using SuperSocket.SocketBase.Protocol; namespace SuperSocket.SocketBase { /// /// The basic interface for appSession /// public interface IAppSession : ISessionBase { /// /// Gets the app server. /// IAppServer AppServer { get; } /// /// Gets the socket session of the AppSession. /// ISocketSession SocketSession { get; } /// /// Gets the items. /// IDictionary Items { get; } /// /// Gets the config of the server. /// IServerConfig Config { get; } /// /// Gets the local listening endpoint. /// IPEndPoint LocalEndPoint { get; } /// /// Gets or sets the last active time of the session. /// /// /// The last active time. /// DateTime LastActiveTime { get; set; } /// /// Gets the start time of the session. /// DateTime StartTime { get; } /// /// Closes this session. /// void Close(); /// /// Closes the session by the specified reason. /// /// The close reason. void Close(CloseReason reason); /// /// Gets a value indicating whether this is connected. /// /// /// true if connected; otherwise, false. /// bool Connected { get; } /// /// Gets or sets the charset which is used for transfering text message. /// /// The charset. Encoding Charset { get; set; } /// /// Gets or sets the previous command. /// /// /// The prev command. /// string PrevCommand { get; set; } /// /// Gets or sets the current executing command. /// /// /// The current command. /// string CurrentCommand { get; set; } /// /// Gets the logger assosiated with this session. /// ILog Logger { get; } /// /// Processes the request. /// /// The read buffer. /// The offset. /// The length. /// if set to true [to be copied]. /// return offset delta of next receiving buffer int ProcessRequest(byte[] readBuffer, int offset, int length, bool toBeCopied); /// /// Starts the session. /// void StartSession(); } /// /// The interface for appSession /// /// The type of the app session. /// The type of the request info. public interface IAppSession : IAppSession where TRequestInfo : IRequestInfo where TAppSession : IAppSession, IAppSession, new() { /// /// Initializes the specified session. /// /// The server. /// The socket session. void Initialize(IAppServer server, ISocketSession socketSession); } }