Ejemplo n.º 1
0
        public QueryTimeout(QueryTimeout value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_IsCommand = false;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
        }
Ejemplo n.º 2
0
        public Resume(Resume value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_IsCommand = true;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
        }
Ejemplo n.º 3
0
        public ConfirmEventRequest(ConfirmEventRequest value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body = new Body();
            m_IsCommand = false;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body = value.m_Body;
        }
Ejemplo n.º 4
0
        public ConfirmEventRequest(ConfirmEventRequest value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body      = new Body();
            m_IsCommand = false;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body      = value.m_Body;
        }
Ejemplo n.º 5
0
        public SetEmergency(SetEmergency value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body      = new Body();
            m_IsCommand = true;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body      = value.m_Body;
        }
Ejemplo n.º 6
0
        public RejectControl(RejectControl value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body = new Body();
            m_IsCommand = false;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body = value.m_Body;
        }
Ejemplo n.º 7
0
        public ReportTimeout(ReportTimeout value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body = new Body();
            m_IsCommand = false;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body = value.m_Body;
        }
Ejemplo n.º 8
0
        public CreateCommandEvent(CreateCommandEvent value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body = new Body();
            m_IsCommand = true;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body = value.m_Body;
        }
Ejemplo n.º 9
0
        public CreateCommandEvent(CreateCommandEvent value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body      = new Body();
            m_IsCommand = true;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body      = value.m_Body;
        }
Ejemplo n.º 10
0
        public QueryEvents(QueryEvents value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body      = new Body();
            m_IsCommand = false;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body      = value.m_Body;
        }
Ejemplo n.º 11
0
        public QueryEvents(QueryEvents value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body = new Body();
            m_IsCommand = false;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body = value.m_Body;
        }
Ejemplo n.º 12
0
        public SetAuthority(SetAuthority value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body = new Body();
            m_IsCommand = true;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body = value.m_Body;
        }
Ejemplo n.º 13
0
        public RequestControl(RequestControl value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body      = new Body();
            m_IsCommand = true;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body      = value.m_Body;
        }
Ejemplo n.º 14
0
        public ClearEmergency(ClearEmergency value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body = new Body();
            m_IsCommand = true;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body = value.m_Body;
        }
Ejemplo n.º 15
0
        public ReportIdentification(ReportIdentification value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body      = new Body();
            m_IsCommand = false;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body      = value.m_Body;
        }
Ejemplo n.º 16
0
        private void CmdProcStopStreamingReply(MsgHeader pkt)
        {
            if (pkt is not StopStreamingReply msg)
            {
                return;
            }

            if (stopStreamingWaitHandle.Set())
            {
                eventAggregator.GetEvent <StopStreamingReplyEvent>().Publish(msg);
            }
        }
Ejemplo n.º 17
0
        private void CmdProcLensArgsReply(MsgHeader pkt)
        {
            if (pkt is not LensArgsReply msg)
            {
                return;
            }

            if (lenArgsWaitHandle.Set())
            {
                this.eventAggregator.GetEvent <LensArgsReplyEvent>().Publish(msg);
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Parses for MsgHeader and MsgStatus
        /// </summary>
        /// <param name="bytes">A byte array of a serialized MsgStatus/MsgHeader class.</param>
        /// <param name="byteCount">Count of bytes in the serialized array.</param>
        public HeaderStatusReader(byte[] bytes, int byteCount)
        {
            // basic validation first to help fail fast
            if (bytes == null || bytes.Length == 0)
            {
                throw new NATSInvalidHeaderException(SerializedHeaderCannotBeNullOrEmpty);
            }
            if (bytes.Length < byteCount)
            {
                throw new NATSInvalidHeaderException("invalid byte count");
            }
            if (byteCount < MinimalValidHeaderLen)
            {
                throw new NATSInvalidHeaderException();
            }

            // is tis the correct version
            for (int x = 0; x < HeaderVersionBytesLen; x++)
            {
                if (bytes[x] != HeaderVersionBytes[x])
                {
                    throw new NATSInvalidHeaderException(InvalidHeaderVersion);
                }
            }

            // does the header end properly
            _serializedLength = byteCount;
            Token terminus = new Token(bytes, _serializedLength, _serializedLength - 2, TokenType.Crlf);
            Token token    = new Token(bytes, _serializedLength, HeaderVersionBytesLen, null);

            _header = new MsgHeader();

            bool hadStatus = false;

            if (token.IsType(TokenType.Space))
            {
                token = InitStatus(bytes, _serializedLength, token);
                if (token.SamePoint(terminus))
                {
                    return; // status only
                }
                hadStatus = true;
            }

            if (token.IsType(TokenType.Crlf))
            {
                InitHeader(bytes, _serializedLength, token, hadStatus);
            }
            else
            {
                throw new NATSInvalidHeaderException(InvalidHeaderComposition);
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 将消息按JT/T 808协议进行编码为字节数组
        /// </summary>
        /// <returns></returns>
        public byte[] Encode()
        {
            if (MsgHeader == null)
            {
                throw new Exception("Field: msgHead cannot be null.");
            }

            // 消息头编码
            byte[] msgHeadBytes = MsgHeader.Encode();

            // body
            byte[] msgBodyBytes = null;
            if (MsgBody != null)
            {
                msgBodyBytes = MsgBody;
            }

            // 构建消息(不包含校验码和头尾标识)
            byte[] message = null;
            if (msgBodyBytes != null)
            {
                ByteBuffer msgbuf = ByteBuffer.Allocate(
                    msgHeadBytes.Length + msgBodyBytes.Length);
                msgbuf.Put(msgHeadBytes);
                msgbuf.Put(msgBodyBytes);
                message = msgbuf.Array();
            }
            else
            {
                message = msgHeadBytes;
            }

            // 计算校验码
            byte       checkCode     = JT808ProtoDecoder.CheckCode(message);
            ByteBuffer checkedBuffer = ByteBuffer.Allocate(message.Length + 1);

            checkedBuffer.Put(message);
            checkedBuffer.Put(checkCode);
            byte[] checkedMessage = checkedBuffer.Array();

            // 转义
            byte[] escapedMessage = JT808ProtoDecoder.Escape(checkedMessage);

            // 增加标识位
            ByteBuffer buffer = ByteBuffer.Allocate(escapedMessage.Length + 2);

            buffer.Put(JT808Constant.PKG_DELIMITER);
            buffer.Put(escapedMessage);
            buffer.Put(JT808Constant.PKG_DELIMITER);

            return(buffer.Array());
        }
Ejemplo n.º 20
0
        public void TestHeaderCopyConstructor()
        {
            var mh = new MsgHeader();

            mh["foo"] = "bar";

            var mh2 = new MsgHeader(mh);

            Assert.Equal("bar", mh2["foo"]);

            Assert.Throws <ArgumentNullException>(() => new MsgHeader(null));
            Assert.Throws <ArgumentException>(() => new MsgHeader(new MsgHeader()));
        }
Ejemplo n.º 21
0
        static KeyValueUtil()
        {
            DeleteHeaders = new MsgHeader
            {
                { KvOperationHeaderKey, KeyValueOperation.Delete.HeaderValue }
            };

            PurgeHeaders = new MsgHeader
            {
                { KvOperationHeaderKey, KeyValueOperation.Purge.HeaderValue },
                { JetStreamConstants.RollupHeader, JetStreamConstants.RollupHeaderSubject }
            };
        }
Ejemplo n.º 22
0
        private PublishAck PublishSyncInternal(string subject, byte[] data, MsgHeader hdr, PublishOptions options)
        {
            MsgHeader merged = MergePublishOptions(hdr, options);
            Msg       msg    = new Msg(subject, null, merged, data);

            if (JetStreamOptions.IsPublishNoAck)
            {
                Conn.Publish(msg);
                return(null);
            }

            return(ProcessPublishResponse(Conn.Request(msg), options));
        }
Ejemplo n.º 23
0
    void OnData(DataStreamReader stream, int i)
    {
        NativeArray <byte> bytes = new NativeArray <byte>(stream.Length, Allocator.Temp);

        stream.ReadBytes(bytes);
        string    message = Encoding.ASCII.GetString(bytes.ToArray());
        MsgHeader header  = JsonUtility.FromJson <MsgHeader>(message);

        if ((header.cmd & Commands.PLAYER_UPDATE) == Commands.PLAYER_UPDATE)
        {
            ProcessPlayerMessage(message);
        }
    }
Ejemplo n.º 24
0
        private void CmdProcDisconnectCameraReply(MsgHeader pkt)
        {
            if (pkt is not DisconnectCameraReply msg)
            {
                return;
            }

            disconnectCameraAck = msg.Ack == 0;
            if (disconnectCameraWaitHandle.Set())
            {
                eventAggregator.GetEvent <DisconnectCameraReplyEvent>().Publish(msg);
            }
        }
Ejemplo n.º 25
0
        private void CmdProcCaptureReply(MsgHeader pkt)
        {
            if (pkt is not CaptureReply msg)
            {
                return;
            }

            this.captureAck = msg.ACK;
            if (captureWaitHandle.Set())
            {
                eventAggregator.GetEvent <CaptureReplyEvent>().Publish(msg);
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        ///
        /// </summary>
        public void QueryTopInfo()
        {
            MsgHeader mh = new MsgHeader();

            //参数赋值
            mh.MsgID = ConstIDs.O_TDMOM_TOP_INFO_REQ;

            mh.puData  = 0;
            mh.DataLen = 0;
            mh.MsgLen  = (uint)Marshal.SizeOf(mh);

            byte[] res_mh = StructConverter.StructToBytes(mh);
        }
Ejemplo n.º 27
0
    void OnData(DataStreamReader stream)
    {
        NativeArray <byte> bytes = new NativeArray <byte>(stream.Length, Allocator.Temp);

        stream.ReadBytes(bytes);
        string    recMsg = Encoding.ASCII.GetString(bytes.ToArray());
        MsgHeader header = JsonUtility.FromJson <MsgHeader>(recMsg);

        if ((header.cmd & Commands.SERVER_UPDATE) == Commands.SERVER_UPDATE)
        {
            ProcessServerMessage(recMsg);
        }
    }
Ejemplo n.º 28
0
        private void CmdProcConfigAlgReply(MsgHeader pkt)
        {
            if (pkt is not ConfigAlgReply msg)
            {
                return;
            }

            configAlgAck = msg.ConfigAck == 0;
            if (configAlgWaitHandle.Set())
            {
                eventAggregator.GetEvent <ConfigAlgReplyEvent>().Publish(msg);
            }
        }
Ejemplo n.º 29
0
        private void CmdProConnectCameraReply(MsgHeader pkt)
        {
            if (pkt is not ConnectCameraReply msg)
            {
                return;
            }

            this.CamChipID = msg.ToFChipID;
            if (connectCameraWaitHandle.Set())
            {
                eventAggregator.GetEvent <ConnectCameraReplyEvent>().Publish(msg);
            }
        }
Ejemplo n.º 30
0
        private void CmdProConfigCameraReply(MsgHeader pkt)
        {
            if (!(pkt is ConfigCameraReply msg))
            {
                return;
            }

            configCameraSuccess = msg.ConfigAck;
            if (configCameraWaitHandle.Set())
            {
                eventAggregator.GetEvent <ConfigCameraReplyEvent>().Publish(msg);
            }
        }
Ejemplo n.º 31
0
        /// <summary>
        /// 
        /// </summary>
        public void QueryRouteInfo()
        {
            MsgHeader mh = new MsgHeader();
            //参数赋值
            mh.MsgID = ConstIDs.O_TDMOM_ROUTE_INFO_REQ;
            
            mh.puData = 0;
            mh.DataLen = 0;
            mh.MsgLen = (uint)Marshal.SizeOf(mh);

            byte[] res_mh = StructConverter.StructToBytes(mh);
            //发送

        }
Ejemplo n.º 32
0
        public void TestHeaderMultiValueSerialization()
        {
            string headers = $"NATS/1.0\r\nfoo:bar\r\nfoo:baz,comma\r\n\r\n";

            byte[] headerBytes = Encoding.UTF8.GetBytes(headers);
            var    mh          = new MsgHeader(headerBytes, headerBytes.Length);

            byte[] bytes = mh.ToByteArray();
            Assert.True(bytes.Length == headerBytes.Length);
            for (int i = 0; i < bytes.Length; i++)
            {
                Assert.True(headerBytes[i] == bytes[i]);
            }
        }
Ejemplo n.º 33
0
        private void Init()
        {
            JSONNode miNode = JsonNode[ApiConstants.Message];

            Subject  = miNode[ApiConstants.Subject].Value;
            Sequence = miNode[ApiConstants.Seq].AsUlong;
            Time     = JsonUtils.AsDate(miNode[ApiConstants.Time]);
            Data     = JsonUtils.AsByteArrayFromBase64(miNode[ApiConstants.Data]);
            byte[] bytes = JsonUtils.AsByteArrayFromBase64(miNode[ApiConstants.Hdrs]);
            if (bytes != null)
            {
                Headers = new HeaderStatusReader(bytes, bytes.Length).Header;
            }
        }
Ejemplo n.º 34
0
        public override bool SendTo(ClientId id, IMessage msg)
        {
            var cl = clients[id];

            if (cl.DeferredDisconnect)
            {
                Root.Log(LogLevel.Debug, "Server: attempt to send message to disconnected client");
                return(false);
            }
            using (var rawBuf = new MemoryStream())
            {
                var buf    = rawBuf.AsUnclosable();
                var header = new MsgHeader {
                    Id = msg.Id, Flags = MessageFlags.None
                };
                if (cl.Secure)
                {
                    using (var container = new MessageCryptoContainer())
                    {
                        symCp.Key = cl.SessionKey;
                        // XXX: generate new symCp.IV
                        container.Store(msg, symCp, Protocol);
                        container.Save(buf, Protocol);
                        header.Size   = (int)buf.Length;
                        header.Flags |= MessageFlags.Secure;
                    }
                }
                else
                {
                    msg.Save(buf, Protocol);
                    header.Size = (int)buf.Length;
                }
                try
                {
                    header.Save(cl.NetStream, Protocol);
                    rawBuf.WriteTo(cl.NetStream);
                }
                catch (IOException e)
                {
                    if (NetUtil.CheckConnectionReset(e))
                    {
                        OnClientConnectionReset(cl);
                        return(false);
                    }
                    throw;
                }
                return(true);
            }
        }
Ejemplo n.º 35
0
        private bool ReceiveMessage(MsgHeader hdr, out IMessage msg)
        {
            msg = null;
            // XXX: could be optimized - use one large buffer + unclosable MemoryStream
            var buf = new byte[hdr.Size];

            try
            {
                netStream.Read(buf, 0, buf.Length);
            }
            catch (IOException e)
            {
                if (NetUtil.CheckConnectionReset(e))
                {
                    OnServerConnectionReset();
                    return(false);
                }
                throw;
            }
            using (var ms = new MemoryStream(buf))
            {
                var msWrap = ms.AsUnclosable();
                if ((hdr.Flags & MessageFlags.Secure) == MessageFlags.Secure)
                {
                    using (var container = new MessageCryptoContainer())
                    {
                        container.Load(msWrap, cfg.Protocol);
                        symCp.Key = sessionKey;
                        msg       = container.Extract(hdr.Id, symCp, cfg.Protocol);
                    }
                }
                else
                {
                    msg = MessageFactory.CreateMessage(hdr.Id);
                    try
                    {
                        msg.Load(msWrap, cfg.Protocol);
                    }
                    catch (MessageLoadException e)
                    {
                        Root.Log(LogLevel.Warning, "Client: bad message received from server ({0})", e.Message);
                        Disconnect();
                        return(false);
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 36
0
        public override void Update()
        {
            var hdr = new MsgHeader();

            // try to read one message from each client
            foreach (var pair in clients)
            {
                var cl = pair.Value;
                if (!CheckClientConnection(cl))
                {
                    OnClientConnectionReset(cl);
                    continue;
                }
                if (cl.Params.Socket.Available == 0)
                {
                    continue;
                }
                if (!ReceiveMessageHeader(hdr, cl))
                {
                    continue;
                }
                if (hdr.Id.IsAuthRequired() && !cl.Authenticated)
                {
                    Root.Log(LogLevel.Error, "Discarding message [{0}] from non-authenticated client: {1}",
                             hdr.Id, GetClientName(cl));
                    DisconnectClient(cl, DisconnectReason.Unknown, "Can't process message without authentication");
                    continue;
                }
                var reqAccess = hdr.Id.GetRequiredAccess();
                var clAccess  = cl.AccessFlags;
                if ((reqAccess & clAccess) != reqAccess)
                {
                    Root.Log(LogLevel.Error, "Discarding message [{0}] from client {1}: insufficient permissions",
                             hdr.Id, GetClientName(cl));
                    DisconnectClient(cl, DisconnectReason.Unknown, "Insufficient permissions");
                    continue;
                }
                IMessage msg;
                if (!ReceiveMessage(hdr, cl, out msg))
                {
                    continue;
                }
                OnMessage(msg, cl.Id);
            }
            ProcessDisconnectedClients();
            ProcessNewClients();
            ProcessSvcMessages();
        }
Ejemplo n.º 37
0
        public void TestHeaderExceptions()
        {
            Assert.Throws <NATSException>(() => new MsgHeader(null, 1));
            Assert.Throws <NATSException>(() => new MsgHeader(new byte[16], 17));
            Assert.Throws <NATSException>(() => new MsgHeader(null, 1));
            Assert.Throws <NATSException>(() => new MsgHeader(new byte[16], 0));
            Assert.Throws <NATSException>(() => new MsgHeader(new byte[16], -1));

            Assert.Throws <ArgumentNullException>(() => new MsgHeader(null));

            byte[] b = Encoding.UTF8.GetBytes("GARBAGE");
            Assert.Throws <NATSInvalidHeaderException>(() => new MsgHeader(b, b.Length));

            // No headers
            b = Encoding.UTF8.GetBytes("NATS/1.0");
            Assert.Throws <NATSInvalidHeaderException>(() => new MsgHeader(b, b.Length));

            // No headers
            b = Encoding.UTF8.GetBytes("NATS/1.0\r\n");
            Assert.Throws <NATSInvalidHeaderException>(() => new MsgHeader(b, b.Length));

            // Missing last \r\n
            b = Encoding.UTF8.GetBytes("NATS/1.0\r\nk1:v1\r\n");
            Assert.Throws <NATSInvalidHeaderException>(() => new MsgHeader(b, b.Length));

            // invalid headers
            b = Encoding.UTF8.GetBytes("NATS/1.0\r\ngarbage\r\n\r\n");
            Assert.Throws <NATSInvalidHeaderException>(() => new MsgHeader(b, b.Length));

            // missing key
            b = Encoding.UTF8.GetBytes("NATS/1.0\r\n:value\r\n\r\n");
            Assert.Throws <NATSInvalidHeaderException>(() => new MsgHeader(b, b.Length));

            // test invalid characters
            var mh = new MsgHeader();

            Assert.Throws <ArgumentException>(() => mh["k\r\ney"] = "value");
            Assert.Throws <ArgumentException>(() => mh["key"]     = "val\r\nue");
            Assert.Throws <ArgumentException>(() => mh["foo:bar"] = "value");
            Assert.Throws <ArgumentException>(() => mh["foo"]     = "value\f");
            Assert.Throws <ArgumentException>(() => mh["foo\f"]   = "value");

            // test constructor with invalid assignment
            Assert.Throws <ArgumentException>(() => new MsgHeader()
            {
                ["foo:bar"] = "baz"
            });
        }
Ejemplo n.º 38
0
        public void TestHeaderSerialization()
        {
            string headers = $"NATS/1.0\r\nfoo:bar\r\n\r\n";

            byte[] headerBytes = System.Text.Encoding.UTF8.GetBytes(headers);

            // can only test with one because order isn't guaranteed
            var mh = new MsgHeader();

            mh["foo"] = "bar";

            byte[] bytes = mh.ToByteArray();
            Assert.True(bytes.Length == headerBytes.Length);

            for (int i = 0; i < bytes.Length; i++)
            {
                Assert.True(headerBytes[i] == bytes[i]);
            }

            // now serialize back
            var mh2 = new MsgHeader(bytes, bytes.Length);

            Assert.Equal("bar", mh2["foo"]);

            // large header
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < 20480; i++)
            {
                sb.Append("N");
            }
            string lv = sb.ToString();

            mh["LargeValue"] = lv;

            // test null and empty values
            mh["Null-Value"]  = null;
            mh["Empty-Value"] = "";

            bytes = mh.ToByteArray();

            // now serialize back
            mh2 = new MsgHeader(bytes, bytes.Length);
            Assert.Equal("bar", mh2["foo"]);
            Assert.Equal("", mh2["Null-Value"]);
            Assert.Equal("", mh2["Empty-Value"]);
            Assert.Equal(lv, mh2["LargeValue"]);
        }
Ejemplo n.º 39
0
        public int Receive(Socket s)
        {
            byte[] bytes = new byte[MsgHeader.GetSize()];
            s.Receive(bytes, MsgHeader.GetSize(), SocketFlags.None);

            m_header.TransformToMsgHeader(bytes);

            if (m_header.m_size > 0)
            {
                bytes = new byte[m_header.m_size + 1];
                s.Receive(bytes, m_header.m_size + 1, SocketFlags.None);
                m_data = cp1251.GetString(bytes, 0, m_header.m_size);
            }

            return(m_header.m_type);
        }
Ejemplo n.º 40
0
        private MsgHeader MergePublishOptions(MsgHeader headers, PublishOptions opts)
        {
            // never touch the user's original headers
            MsgHeader merged = headers == null ? null : new MsgHeader(headers);

            if (opts != null)
            {
                merged = MergeNum(merged, JetStreamConstants.ExpLastSeqHeader, opts.ExpectedLastSeq);
                merged = MergeNum(merged, JetStreamConstants.ExpLastSubjectSeqHeader, opts.ExpectedLastSubjectSeq);
                merged = MergeString(merged, JetStreamConstants.ExpLastIdHeader, opts.ExpectedLastMsgId);
                merged = MergeString(merged, JetStreamConstants.ExpStreamHeader, opts.ExpectedStream);
                merged = MergeString(merged, JetStreamConstants.MsgIdHeader, opts.MessageId);
            }

            return(merged);
        }
Ejemplo n.º 41
0
        /// <summary>
        /// 
        /// </summary>
        public void SendIpInfo()
        {
            MsgHeader mh = new MsgHeader();
            //参数赋值
            mh.MsgID = ConstIDs.O_TDMOM_IP_PORT_CFG;

            mh.puData = 0;
            mh.DataLen = 0;
            mh.MsgLen = (uint)Marshal.SizeOf(mh);

            byte[] res_mh = StructConverter.StructToBytes(mh);

            IpPortCFCStruct ips = new IpPortCFCStruct();
            byte[] strbytes= System.Text.Encoding.Unicode.GetBytes(_configService.ConfigInfos.TermialIP);
            Buffer.BlockCopy(strbytes, 0, ips.IpAddr, 0, ips.IpAddr.Length > strbytes.Length ? strbytes.Length : ips.IpAddr.Length);
            ips.PortNum = (uint)_configService.ConfigInfos.TerminalPort;

            //发送

        }
Ejemplo n.º 42
0
            public MsgHeader(MsgHeader value)
            {
                /// Initiliaze the protected variables
                m_HeaderRec = new HeaderRec();
                m_HeaderRec.setParent(this);

                /// Copy the values
                m_HeaderRec = value.getHeaderRec();
                m_HeaderRec.setParent(this);
            }
Ejemplo n.º 43
0
 public SetAuthority()
 {
     m_MsgHeader = new MsgHeader();
     m_Body = new Body();
     m_IsCommand = true;
 }
Ejemplo n.º 44
0
 public void setMsgHeader(MsgHeader value)
 {
     m_MsgHeader = value;
 }
Ejemplo n.º 45
0
        public SetAuthority setAs(SetAuthority value)
        {
            m_MsgHeader = value.m_MsgHeader;
            m_Body = value.m_Body;

            return this;
        }
Ejemplo n.º 46
0
 public HeaderRec()
 {
     m_parent = null;
     m_MessageID = 0x4003;
 }
Ejemplo n.º 47
0
 public ConfirmEventRequest()
 {
     m_MsgHeader = new MsgHeader();
     m_Body = new Body();
     m_IsCommand = false;
 }
Ejemplo n.º 48
0
 public ReportTimeout()
 {
     m_MsgHeader = new MsgHeader();
     m_Body = new Body();
     m_IsCommand = false;
 }
Ejemplo n.º 49
0
        public ReportTimeout setAs(ReportTimeout value)
        {
            m_MsgHeader = value.m_MsgHeader;
            m_Body = value.m_Body;

            return this;
        }
Ejemplo n.º 50
0
            public RejectEventRequest.MsgHeader setMsgHeader(MsgHeader value)
            {
                m_HeaderRec = value.getHeaderRec();
                m_HeaderRec.setParent(this);

                return this;
            }
Ejemplo n.º 51
0
                public HeaderRec(HeaderRec value)
                {
                    /// Initiliaze the protected variables
                    m_parent = null;
                    m_MessageID = 0x0001;

                    /// Copy the values
                    m_MessageID = value.m_MessageID;
                }
Ejemplo n.º 52
0
            public SetAuthority.MsgHeader setMsgHeader(MsgHeader value)
            {
                m_HeaderRec = value.getHeaderRec();
                m_HeaderRec.setParent(this);

                return this;
            }
Ejemplo n.º 53
0
 public bool isEqual(MsgHeader value)
 {
     if (!this.getHeaderRec().isEqual(value.getHeaderRec()))
     {
     return false;
     }
     return true;
 }
Ejemplo n.º 54
0
            public ReportTimeout.MsgHeader setMsgHeader(MsgHeader value)
            {
                m_HeaderRec = value.getHeaderRec();
                m_HeaderRec.setParent(this);

                return this;
            }
Ejemplo n.º 55
0
 public bool notEquals(MsgHeader value)
 {
     return !this.isEqual(value);
 }
Ejemplo n.º 56
0
        public ConfirmEventRequest setAs(ConfirmEventRequest value)
        {
            m_MsgHeader = value.m_MsgHeader;
            m_Body = value.m_Body;

            return this;
        }
Ejemplo n.º 57
0
 public HeaderRec()
 {
     m_parent = null;
     m_MessageID = 0x0001;
 }
Ejemplo n.º 58
0
        public RejectEventRequest setAs(RejectEventRequest value)
        {
            m_MsgHeader = value.m_MsgHeader;
            m_Body = value.m_Body;

            return this;
        }
Ejemplo n.º 59
0
 public void setParent(MsgHeader parent)
 {
     m_parent = parent;
 }
Ejemplo n.º 60
0
 public RejectEventRequest()
 {
     m_MsgHeader = new MsgHeader();
     m_Body = new Body();
     m_IsCommand = false;
 }