1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /* Copyright (C) 2012-2016 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
- *
- * You can redistribute this program and/or modify it under the terms of
- * the GNU Lesser Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- */
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Net;
- using Utilities;
- namespace ISCSI.Server
- {
- public class TransferEntry
- {
- public SCSICommandPDU Command;
- public uint NextR2TSN;
- public TransferEntry(SCSICommandPDU command, uint nextR2TSN)
- {
- Command = command;
- NextR2TSN = nextR2TSN;
- }
- }
- public class ConnectionParameters
- {
- public ushort CID; // connection ID, generated by the initiator
- public string InitiatorName = String.Empty;
- public IPEndPoint InitiatorEndPoint;
- public int InitiatorMaxRecvDataSegmentLength = DefaultParameters.Connection.MaxRecvDataSegmentLength;
- public int TargetMaxRecvDataSegmentLength = ISCSIServer.DeclaredParameters.MaxRecvDataSegmentLength;
- public uint StatSN = 0; // Initial StatSN, any number will do
- // Dictionary of current transfers: <transfer-tag, TransferEntry>
- private Dictionary<uint, TransferEntry> n_transfers = new Dictionary<uint, TransferEntry>();
- public TransferEntry AddTransfer(uint transferTag, SCSICommandPDU command, uint nextR2TSN)
- {
- TransferEntry entry = new TransferEntry(command, nextR2TSN);
- n_transfers.Add(transferTag, entry);
- return entry;
- }
- public TransferEntry GetTransferEntry(uint transferTag)
- {
- TransferEntry result;
- n_transfers.TryGetValue(transferTag, out result);
- return result;
- }
- public void RemoveTransfer(uint transferTag)
- {
- n_transfers.Remove(transferTag);
- }
- }
- }
|