public static void Disconnect()
        {
            Condition.IsTrue(State == ModelState.Connected);
            Condition.IsNull(Request);
            Condition.IsNotNull(Open);

            ModelHelper.Log(LogType.Requirement, "3.3.7.1 Handling Loss of a Connection");
            if (Config.IsLeasingSupported && Open.IsResilient)
            {
                ModelHelper.Log(LogType.Requirement,
                                "If any of the following conditions is satisfied, it indicates that the Open is to be preserved for reconnect. ");
                ModelHelper.Log(LogType.Requirement, "\tThe server supports leasing and Open.IsResilient is TRUE.");
                ModelHelper.Log(LogType.TestInfo, "The above conditions are met.");
                ModelHelper.Log(LogType.TestInfo, "The Open is preserved.");
            }
            else if (Open.IsDurable)
            {
                ModelHelper.Log(LogType.Requirement,
                                "If any of the following conditions is satisfied, it indicates that the Open is to be preserved for reconnect. ");
                ModelHelper.Log(LogType.Requirement, "\tOpen.OplockLevel is equal to SMB2_OPLOCK_LEVEL_BATCH and Open.OplockState is equal to Held, and Open.IsDurable is TRUE.");
                ModelHelper.Log(LogType.TestInfo, "The above conditions are met.");
                ModelHelper.Log(LogType.TestInfo, "The Open is preserved.");
            }
            else
            {
                ModelHelper.Log(LogType.Requirement, "If the Open is not to be preserved for reconnect, the server MUST close the Open as specified in section 3.3.4.17.");
                ModelHelper.Log(LogType.TestInfo, "The Open is closed.");
                Open = null;
            }

            State = ModelState.Disconnected;
        }
        public static void Disconnect()
        {
            Condition.IsTrue(State == ModelState.Connected);
            Condition.IsNull(Request);
            Condition.IsNotNull(Open);

            ModelHelper.Log(LogType.Requirement, "3.3.7.1 Handling Loss of a Connection");
            if (Config.IsLeasingSupported && Open.IsResilient)
            {
                ModelHelper.Log(LogType.Requirement,
                    "If any of the following conditions is satisfied, it indicates that the Open is to be preserved for reconnect. ");
                ModelHelper.Log(LogType.Requirement, "\tThe server supports leasing and Open.IsResilient is TRUE.");
                ModelHelper.Log(LogType.TestInfo, "The above conditions are met.");
                ModelHelper.Log(LogType.TestInfo, "The Open is preserved.");
            }
            else if (Open.IsDurable)
            {
                ModelHelper.Log(LogType.Requirement,
                    "If any of the following conditions is satisfied, it indicates that the Open is to be preserved for reconnect. ");
                ModelHelper.Log(LogType.Requirement, "\tOpen.OplockLevel is equal to SMB2_OPLOCK_LEVEL_BATCH and Open.OplockState is equal to Held, and Open.IsDurable is TRUE.");
                ModelHelper.Log(LogType.TestInfo, "The above conditions are met.");
                ModelHelper.Log(LogType.TestInfo, "The Open is preserved.");
            }
            else
            {
                ModelHelper.Log(LogType.Requirement, "If the Open is not to be preserved for reconnect, the server MUST close the Open as specified in section 3.3.4.17.");
                ModelHelper.Log(LogType.TestInfo, "The Open is closed.");
                Open = null;
            }

            State = ModelState.Disconnected;
        }
        public static void PrepareOpen(ModelDialectRevision clientMaxDialect, DurableHandle durableHandle)
        {
            Condition.IsTrue(State == ModelState.Initialized);

            Connection_Dialect = ModelHelper.DetermineNegotiateDialect(clientMaxDialect, Config.MaxSmbVersionSupported);

            State = ModelState.Connected;
            Open  = new ModelOpen(durableHandle == DurableHandle.DurableHandle? true : false);
        }
Ejemplo n.º 4
0
        public void CloseModelOpen()
        {
            if (ModelOpen == null)
            {
                return;
            }

            if (ModelOpen.IsEnabled)
            {
                ModelOpen.Close();
            }
        }
        public static void LogOff()
        {
            Condition.IsTrue(State == ModelState.Connected);
            Condition.IsNull(Request);
            Condition.IsNotNull(Open);

            if (!Open.IsResilient && !Open.IsDurable)
            {
                ModelHelper.Log(LogType.Requirement,
                                "3.3.5.6: The server MUST close every Open in Session.OpenTable of the old session, " +
                                "where Open.IsDurable is FALSE and Open.IsResilient is FALSE, as specified in section 3.3.4.17.");
                ModelHelper.Log(LogType.TestInfo, "Open.IsDurable is FALSE and Open.IsResilient is FALSE, so the open is closed.");
                Open = null;
            }
        }
        public static void PrepareOpen(ModelDialectRevision clientMaxDialect, DurableHandle durableHandle)
        {
            Condition.IsTrue(State == ModelState.Initialized);

            Connection_Dialect = ModelHelper.DetermineNegotiateDialect(clientMaxDialect, Config.MaxSmbVersionSupported);

            State = ModelState.Connected;
            Open = new ModelOpen(durableHandle == DurableHandle.DurableHandle? true : false);
        }
        public static void LogOff()
        {
            Condition.IsTrue(State == ModelState.Connected);
            Condition.IsNull(Request);
            Condition.IsNotNull(Open);

            if (!Open.IsResilient && !Open.IsDurable)
            {
                ModelHelper.Log(LogType.Requirement,
                    "3.3.5.6: The server MUST close every Open in Session.OpenTable of the old session, " +
                    "where Open.IsDurable is FALSE and Open.IsResilient is FALSE, as specified in section 3.3.4.17.");
                ModelHelper.Log(LogType.TestInfo, "Open.IsDurable is FALSE and Open.IsResilient is FALSE, so the open is closed.");
                Open = null;
            }
        }