work with ZRE messages - as generated by ZProt
Exemplo n.º 1
0
            internal void Read(ZreMsgOriginal m)
            {
                int listSize;
                int hashSize;
                int chunkSize;

                byte[] guidBytes;
                byte   version;

                // Version
                version = m.GetNumber1();
                if (version != 2)
                {
                    throw new MessageException("Version is invalid");
                }

                // Sequence
                Sequence = m.GetNumber2();

                // Group
                Group = m.GetString();

                // Status
                Status = m.GetNumber1();
            }
Exemplo n.º 2
0
            internal void Write(ZreMsgOriginal m)
            {
                // Version
                m.PutNumber1(2);                 // Version

                // Sequence
                m.PutNumber2(Sequence);
            }
Exemplo n.º 3
0
            internal void Write(ZreMsgOriginal m)
            {
                // Version
                m.PutNumber1(2);                 // Version

                // Sequence
                m.PutNumber2(Sequence);

                // Group
                m.PutString(Group);

                // Content
            }
Exemplo n.º 4
0
            internal void Read(ZreMsgOriginal m)
            {
                int listSize;
                int hashSize;
                int chunkSize;

                byte[] guidBytes;
                byte   version;

                // Version
                version = m.GetNumber1();
                if (version != 2)
                {
                    throw new MessageException("Version is invalid");
                }

                // Sequence
                Sequence = m.GetNumber2();

                // Endpoint
                Endpoint = m.GetString();

                // Groups
                listSize = (int)m.GetNumber4();
                Groups   = new List <string>(listSize);
                while (listSize-- > 0)
                {
                    string s = m.GetLongString();
                    Groups.Add(s);
                }

                // Status
                Status = m.GetNumber1();

                // Name
                Name = m.GetString();

                // Headers
                hashSize = (int)m.GetNumber4();
                Headers  = new Dictionary <string, string>();
                while (hashSize-- > 0)
                {
                    string key   = m.GetString();
                    string value = m.GetLongString();
                    Headers.Add(key, value);
                }
            }
Exemplo n.º 5
0
            internal void Write(ZreMsgOriginal m)
            {
                // Version
                m.PutNumber1(2);                 // Version

                // Sequence
                m.PutNumber2(Sequence);

                // Endpoint
                m.PutString(Endpoint);

                // Groups
                if (Groups != null)
                {
                    m.PutNumber4((UInt32)Groups.Count);

                    foreach (string s in Groups)
                    {
                        m.PutLongString(s);
                    }
                }
                else
                {
                    m.PutNumber4(0);                        //  Empty string array
                }
                // Status
                m.PutNumber1(Status);

                // Name
                m.PutString(Name);

                // Headers
                if (Headers != null)
                {
                    m.PutNumber4((UInt32)Headers.Count);

                    foreach (var pair in Headers)
                    {
                        m.PutString(pair.Key);
                        m.PutLongString(pair.Value);
                    }
                }
                else
                {
                    m.PutNumber4(0);                        //  Empty dictionary
                }
            }
Exemplo n.º 6
0
			internal void Read(ZreMsgOriginal m)
			{
				int listSize;
				int hashSize;
				int chunkSize;
				byte[] guidBytes;
				byte version;

				// Version
				version = m.GetNumber1();                          
				if (version != 2) 
				{
					throw new MessageException("Version is invalid");						
				}													

				// Sequence
				Sequence = m.GetNumber2();

			}
Exemplo n.º 7
0
			internal void Write(ZreMsgOriginal m)
			{
				// Version
				m.PutNumber1(2); // Version

				// Sequence
				m.PutNumber2(Sequence);

			}
Exemplo n.º 8
0
			internal void Write(ZreMsgOriginal m)
			{
				// Version
				m.PutNumber1(2); // Version

				// Sequence
				m.PutNumber2(Sequence);

				// Group
				m.PutString(Group);

				// Status
				m.PutNumber1(Status);

			}
Exemplo n.º 9
0
			internal void Read(ZreMsgOriginal m)
			{
				int listSize;
				int hashSize;
				int chunkSize;
				byte[] guidBytes;
				byte version;

				// Version
				version = m.GetNumber1();                          
				if (version != 2) 
				{
					throw new MessageException("Version is invalid");						
				}													

				// Sequence
				Sequence = m.GetNumber2();

				// Endpoint
				Endpoint = m.GetString();

				// Groups
				listSize = (int)m.GetNumber4();                
				Groups = new List<string>(listSize);                 
				while (listSize-- > 0) 
				{
					string s = m.GetLongString();
					Groups.Add(s);                    
				}												

				// Status
				Status = m.GetNumber1();

				// Name
				Name = m.GetString();

				// Headers
				hashSize = (int)m.GetNumber4();                
				Headers = new Dictionary<string, string>();                
				while (hashSize-- > 0)  
				{
					string key = m.GetString();
					string value = m.GetLongString();
					Headers.Add(key, value);
				}						

			}
Exemplo n.º 10
0
			internal void Write(ZreMsgOriginal m)
			{
				// Version
				m.PutNumber1(2); // Version

				// Sequence
				m.PutNumber2(Sequence);

				// Endpoint
				m.PutString(Endpoint);

				// Groups
				if (Groups != null) 
				{
					m.PutNumber4((UInt32)Groups.Count);

					foreach (string s in Groups)
					{
						m.PutLongString(s);
					}                
				}
				else
					m.PutNumber4(0);    //  Empty string array

				// Status
				m.PutNumber1(Status);

				// Name
				m.PutString(Name);

				// Headers
				if (Headers != null) 
				{
					m.PutNumber4((UInt32)Headers.Count);
               
					foreach(var pair in Headers)
					{
						m.PutString(pair.Key);
						m.PutLongString(pair.Value);
					}				
				}
				else
					m.PutNumber4(0);    //  Empty dictionary

			}