/* Copyright (C) 2012-2016 Tal Aloni . 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 Utilities; namespace ISCSI.Server { public class TransferEntry { public SCSICommandPDU Command; public uint NextR2NSN; public TransferEntry(SCSICommandPDU command, uint nextR2NSN) { Command = command; NextR2NSN = nextR2NSN; } } public class ConnectionParameters { /// /// The default MaxRecvDataSegmentLength is used during Login /// public const int DefaultMaxRecvDataSegmentLength = 8192; public static int DeclaredMaxRecvDataSegmentLength = 262144; public ushort CID; // connection ID, generated by the initiator /// /// per direction parameter that the target or initator declares. /// maximum data segment length that the target (or initator) can receive in a single iSCSI PDU. /// public int InitiatorMaxRecvDataSegmentLength = DefaultMaxRecvDataSegmentLength; public int TargetMaxRecvDataSegmentLength = DeclaredMaxRecvDataSegmentLength; public uint StatSN = 0; // Initial StatSN, any number will do // Dictionary of current transfers: private Dictionary n_transfers = new Dictionary(); public TransferEntry AddTransfer(uint transferTag, SCSICommandPDU command, uint nextR2NSN) { TransferEntry entry = new TransferEntry(command, nextR2NSN); 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); } } }