예제 #1
0
        static void scu_BeforeAssociateRequest(object sender, BeforeAssociateRequestEventArgs e)
        {
            DicomConnection scu = sender as DicomConnection;

            Utils.LogEvent(LogType.Information, MessageDirection.Output, string.Format(Utils.ASSOCIATE_REQUEST_SENT, e.Associate.ToString()),
                           DicomCommandType.Undefined, null, scu, null);
        }
예제 #2
0
        void find_BeforeCFind(object sender, BeforeCFindEventArgs e)
        {
            DicomConnection connection = sender as DicomConnection;
            string          message    = string.Format(CFIND_REQUEST_SEND, e.MessageId, e.PresentationID, e.AffectedClass, e.Priority);

            LogEvent(LogType.Information, MessageDirection.Output, message, DicomCommandType.CFind, e.Dataset, connection, null);
        }
예제 #3
0
        static void scu_BeforeCMove(object sender, BeforeCMoveEventArgs e)
        {
            DicomConnection scu = sender as DicomConnection;
            string          msg = string.Format(CMOVE_REQUEST_SENT, e.MessageId, e.PresentationID, e.AffectedClass, e.Priority, e.DestinationAETitle);

            Utils.LogEvent(LogType.Information, MessageDirection.Output, msg, DicomCommandType.CMove, e.Dataset, scu, null);
        }
예제 #4
0
        static void scu_AfterCMove(object sender, AfterCMoveEventArgs e)
        {
            DicomConnection scu = sender as DicomConnection;
            string          msg = string.Format(CMOVE_RESPONSE_RECEIVED, e.MessageId, e.PresentationID, e.AffectedClass, e.Status, e.Remaining, e.Completed, e.Failed, e.Warning);

            Utils.LogEvent(LogType.Information, MessageDirection.Input, msg, DicomCommandType.CMove, e.Dataset, scu, null);
        }
예제 #5
0
        public static void LogEvent(LogType type, MessageDirection messageDirection, string description,
                                    DicomCommandType command, DicomDataSet dataset,
                                    DicomConnection Client, SerializableDictionary <string, object> customInformation)
        {
            try
            {
                string   ae  = Client.AETitle;
                DicomNet net = Client as DicomNet;

                SerializableDictionary <string, object> logCustomInformation = DicomLogEntry.CustomInformationDicomMessage;
                if (customInformation != null)
                {
                    logCustomInformation = new SerializableDictionary <string, object>();
                    foreach (KeyValuePair <string, object> kvp in customInformation)
                    {
                        logCustomInformation.Add(kvp.Key, kvp.Value);
                    }
                    logCustomInformation.Add(DicomLogEntry.DicomMessageKey, DicomLogEntry.DicomMessageValue);
                }

                Logger.Global.Log("Forwarder", Client.CurrentScp.AETitle, Client.CurrentScp.PeerAddress.ToString(),
                                  Client.CurrentScp.Port, net.IsAssociated() ? net.Association.Calling : ae,
                                  net.HostAddress != null ? net.HostAddress.ToString() : string.Empty,
                                  net.IsConnected() ? net.HostPort : -1, command, DateTime.Now, type,
                                  messageDirection, description, dataset, logCustomInformation);
            }
            catch (Exception exception)
            {
                Logger.Global.Exception("Forwarder", exception);
            }
        }
예제 #6
0
        public PresentationContextInputStream(DicomConnection connection, FragmentType fragmentType)
        {
            _connection = connection;

            _fragmentType = fragmentType;

            StartReadFragment(isFirstFragment: true);

            PresentationContextID = _fragmentHeader.PresentationContextID;
        }
예제 #7
0
        static void scu_AfterConnect(object sender, AfterConnectEventArgs e)
        {
            DicomConnection scu     = sender as DicomConnection;
            string          message = Utils.CONNECT_RESPONSE_RECEIVED;

            if (e.Error != DicomExceptionCode.Success)
            {
                message = string.Format(Utils.CONNECT_RESPONSE_RECEIVED_FAILURE, e.Error);
            }

            Utils.LogEvent(LogType.Information, MessageDirection.Input, message, DicomCommandType.Undefined, null, scu, null);
        }
예제 #8
0
        private void Find_AfterSecureLinkReady(object sender, AfterSecureLinkReadyEventArgs e)
        {
            DicomConnection connection = sender as DicomConnection;

            if (e.Error == DicomExceptionCode.Success)
            {
                DicomTlsCipherSuiteType cipher = connection.GetTlsCipherSuite();
                GatewaySession.Log(LogType.Information, String.Format(SECURE_LINK_READY_CIPHERSUITE, cipher.GetCipherFriendlyName()));
            }
            else
            {
                GatewaySession.Log(LogType.Information, String.Format(SECURE_LINK_FAILED, e.Error));
            }
        }
예제 #9
0
        static void scu_AfterAssociateRequest(object sender, AfterAssociateRequestEventArgs e)
        {
            DicomConnection scu = sender as DicomConnection;

            if (!e.Rejected)
            {
                Utils.LogEvent(LogType.Information, MessageDirection.Input, Utils.ASSOCIATE_REQUEST_ACCEPTED,
                               DicomCommandType.Undefined, null, scu, null);
            }
            else
            {
                Utils.LogEvent(LogType.Information, MessageDirection.Input, string.Format(Utils.ASSOCIATE_REQUEST_REJECTED, e.Reason),
                               DicomCommandType.Undefined, null, scu, null);
            }
        }
예제 #10
0
        private void AfterSecureLinkReady(object sender, AfterSecureLinkReadyEventArgs e)
        {
            DicomConnection connection = sender as DicomConnection;

            if (e.Error == DicomExceptionCode.Success)
            {
                DicomTlsCipherSuiteType cipher = connection.GetTlsCipherSuite();

                LogEvent(LogType.Information, MessageDirection.Input,
                         String.Format(SECURE_LINK_READY_CIPHERSUITE, cipher.GetCipherFriendlyName()),
                         DicomCommandType.Undefined, null, connection, null);
            }
            else
            {
                LogEvent(LogType.Information, MessageDirection.Input,
                         String.Format(SECURE_LINK_FAILED, e.Error),
                         DicomCommandType.Undefined, null, connection, null);
            }
        }
예제 #11
0
        public PresentationContextOutputStream(DicomConnection connection, byte presentationContextID, FragmentType fragmentType)
        {
            _connection = connection;

            _fragmentHeader.PresentationContextID = presentationContextID;
            _fragmentHeader.FragmentType          = fragmentType;

            var maxDataTransferPDULength = 64 * 1024 - DataTransferPDUHeader.Size;

            if (connection.MaxDataTransferPDULengthRequestedByPeer > 0)
            {
                NetUtils.ThrowIf(connection.MaxDataTransferPDULengthRequestedByPeer % 2 != 0);
                NetUtils.ThrowIf(connection.MaxDataTransferPDULengthRequestedByPeer < FragmentHeader.Size + 2);

                if (connection.MaxDataTransferPDULengthRequestedByPeer < maxDataTransferPDULength)
                {
                    maxDataTransferPDULength = (int)connection.MaxDataTransferPDULengthRequestedByPeer;
                }
            }

            _dataBuffer = new byte[DataTransferPDUHeader.Size + maxDataTransferPDULength];
        }
예제 #12
0
        static void scu_AfterReleaseRequest(object sender, EventArgs e)
        {
            DicomConnection scu = sender as DicomConnection;

            Utils.LogEvent(LogType.Information, MessageDirection.Input, Utils.RELEASE_RESPONSE_RECEIVED, DicomCommandType.Undefined, null, scu, null);
        }
예제 #13
0
        static void scu_BeforeReleaseRequest(object sender, EventArgs e)
        {
            DicomConnection scu = sender as DicomConnection;

            Utils.LogEvent(LogType.Information, MessageDirection.Output, Utils.RELEASE_REQUEST_SENT, DicomCommandType.Undefined, null, scu, null);
        }
예제 #14
0
        void BeforeConnect(object sender, BeforeConnectEventArgs e)
        {
            DicomConnection connection = sender as DicomConnection;

            LogEvent(LogType.Information, MessageDirection.Output, CONNECT_REQUEST_SENT, DicomCommandType.Undefined, null, connection, null);
        }
예제 #15
0
        void BeforeReleaseRequest(object sender, EventArgs e)
        {
            DicomConnection connection = sender as DicomConnection;

            LogEvent(LogType.Information, MessageDirection.Output, RELEASE_REQUEST_SENT, DicomCommandType.Undefined, null, connection, null);
        }
예제 #16
0
        void AfterReleaseRequest(object sender, EventArgs e)
        {
            DicomConnection connection = sender as DicomConnection;

            LogEvent(LogType.Information, MessageDirection.Input, RELEASE_RESPONSE_RECEIVED, DicomCommandType.Undefined, null, connection, null);
        }
예제 #17
0
        static void scu_BeforeConnect(object sender, BeforeConnectEventArgs e)
        {
            DicomConnection scu = sender as DicomConnection;

            Utils.LogEvent(LogType.Information, MessageDirection.Output, Utils.CONNECT_REQUEST_SENT, DicomCommandType.Undefined, null, scu, null);
        }