Esempio n. 1
0
            public SessionErrorMessage Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                ulong            p_sessionId = 0;
                SessionErrorType p_errorType = (SessionErrorType)0;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // SessionId
                    {
                        p_sessionId = r.GetUInt64();
                        break;
                    }

                    case 1:     // ErrorType
                    {
                        p_errorType = (SessionErrorType)r.GetUInt64();
                        break;
                    }
                    }
                }

                return(new SessionErrorMessage(p_sessionId, p_errorType));
            }
Esempio n. 2
0
            public HelloMessage Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                OmniSecureConnectionVersion[] p_versions = System.Array.Empty <OmniSecureConnectionVersion>();

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // Versions
                    {
                        var length = r.GetUInt32();
                        p_versions = new OmniSecureConnectionVersion[length];
                        for (int i = 0; i < p_versions.Length; i++)
                        {
                            p_versions[i] = (OmniSecureConnectionVersion)r.GetUInt64();
                        }
                        break;
                    }
                    }
                }

                return(new HelloMessage(p_versions));
            }
Esempio n. 3
0
            public ProfileMessage Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                ulong p_initialWindowSize         = 0;
                uint  p_maxSessionAcceptQueueSize = 0;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // InitialWindowSize
                    {
                        p_initialWindowSize = r.GetUInt64();
                        break;
                    }

                    case 1:     // MaxSessionAcceptQueueSize
                    {
                        p_maxSessionAcceptQueueSize = r.GetUInt32();
                        break;
                    }
                    }
                }

                return(new ProfileMessage(p_initialWindowSize, p_maxSessionAcceptQueueSize));
            }
Esempio n. 4
0
            public ContentId Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                ContentType p_type = (ContentType)0;
                string      p_path = string.Empty;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // Type
                    {
                        p_type = (ContentType)r.GetUInt64();
                        break;
                    }

                    case 1:     // Path
                    {
                        p_path = r.GetString(1024);
                        break;
                    }
                    }
                }

                return(new ContentId(p_type, p_path));
            }
Esempio n. 5
0
            public OmniHashcash Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                OmniHashcashAlgorithmType p_algorithmType = (OmniHashcashAlgorithmType)0;

                System.ReadOnlyMemory <byte> p_key = System.ReadOnlyMemory <byte> .Empty;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // AlgorithmType
                    {
                        p_algorithmType = (OmniHashcashAlgorithmType)r.GetUInt64();
                        break;
                    }

                    case 1:     // Key
                    {
                        p_key = r.GetMemory(32);
                        break;
                    }
                    }
                }

                return(new OmniHashcash(p_algorithmType, p_key));
            }
Esempio n. 6
0
            public OmniDigitalSignature Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                string p_name = string.Empty;
                OmniDigitalSignatureAlgorithmType p_algorithmType = (OmniDigitalSignatureAlgorithmType)0;

                System.ReadOnlyMemory <byte> p_publicKey  = System.ReadOnlyMemory <byte> .Empty;
                System.ReadOnlyMemory <byte> p_privateKey = System.ReadOnlyMemory <byte> .Empty;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // Name
                    {
                        p_name = r.GetString(32);
                        break;
                    }

                    case 1:     // AlgorithmType
                    {
                        p_algorithmType = (OmniDigitalSignatureAlgorithmType)r.GetUInt64();
                        break;
                    }

                    case 2:     // PublicKey
                    {
                        p_publicKey = r.GetMemory(8192);
                        break;
                    }

                    case 3:     // PrivateKey
                    {
                        p_privateKey = r.GetMemory(8192);
                        break;
                    }
                    }
                }

                return(new OmniDigitalSignature(p_name, p_algorithmType, p_publicKey, p_privateKey));
            }
Esempio n. 7
0
            public OmniAgreement Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                Omnix.Serialization.RocketPack.Timestamp p_creationTime = Omnix.Serialization.RocketPack.Timestamp.Zero;
                OmniAgreementAlgorithmType p_algorithmType = (OmniAgreementAlgorithmType)0;

                System.ReadOnlyMemory <byte> p_publicKey  = System.ReadOnlyMemory <byte> .Empty;
                System.ReadOnlyMemory <byte> p_privateKey = System.ReadOnlyMemory <byte> .Empty;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // CreationTime
                    {
                        p_creationTime = r.GetTimestamp();
                        break;
                    }

                    case 1:     // AlgorithmType
                    {
                        p_algorithmType = (OmniAgreementAlgorithmType)r.GetUInt64();
                        break;
                    }

                    case 2:     // PublicKey
                    {
                        p_publicKey = r.GetMemory(8192);
                        break;
                    }

                    case 3:     // PrivateKey
                    {
                        p_privateKey = r.GetMemory(8192);
                        break;
                    }
                    }
                }

                return(new OmniAgreement(p_creationTime, p_algorithmType, p_publicKey, p_privateKey));
            }
Esempio n. 8
0
            public OmniHash Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                OmniHashAlgorithmType p_algorithmType = (OmniHashAlgorithmType)0;

                System.ReadOnlyMemory <byte> p_value = System.ReadOnlyMemory <byte> .Empty;

                {
                    p_algorithmType = (OmniHashAlgorithmType)r.GetUInt64();
                }
                {
                    p_value = r.GetMemory(256);
                }
                return(new OmniHash(p_algorithmType, p_value));
            }
Esempio n. 9
0
            public SessionDataMessage Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                ulong p_sessionId   = 0;
                bool  p_isCompleted = false;

                System.Buffers.IMemoryOwner <byte> p_data = Omnix.Base.SimpleMemoryOwner <byte> .Empty;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // SessionId
                    {
                        p_sessionId = r.GetUInt64();
                        break;
                    }

                    case 1:     // IsCompleted
                    {
                        p_isCompleted = r.GetBoolean();
                        break;
                    }

                    case 2:     // Data
                    {
                        p_data = r.GetRecyclableMemory(262144);
                        break;
                    }
                    }
                }

                return(new SessionDataMessage(p_sessionId, p_isCompleted, p_data));
            }
Esempio n. 10
0
            public FileId Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                string p_path   = string.Empty;
                ulong  p_length = 0;

                Omnix.Serialization.RocketPack.Timestamp p_lastWriteTime = Omnix.Serialization.RocketPack.Timestamp.Zero;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // Path
                    {
                        p_path = r.GetString(1024);
                        break;
                    }

                    case 1:     // Length
                    {
                        p_length = r.GetUInt64();
                        break;
                    }

                    case 2:     // LastWriteTime
                    {
                        p_lastWriteTime = r.GetTimestamp();
                        break;
                    }
                    }
                }

                return(new FileId(p_path, p_length, p_lastWriteTime));
            }
Esempio n. 11
0
            public ProfileMessage Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                System.ReadOnlyMemory <byte> p_sessionId          = System.ReadOnlyMemory <byte> .Empty;
                AuthenticationType           p_authenticationType = (AuthenticationType)0;

                KeyExchangeAlgorithm[]   p_keyExchangeAlgorithms   = System.Array.Empty <KeyExchangeAlgorithm>();
                KeyDerivationAlgorithm[] p_keyDerivationAlgorithms = System.Array.Empty <KeyDerivationAlgorithm>();
                CryptoAlgorithm[]        p_cryptoAlgorithms        = System.Array.Empty <CryptoAlgorithm>();
                HashAlgorithm[]          p_hashAlgorithms          = System.Array.Empty <HashAlgorithm>();

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // SessionId
                    {
                        p_sessionId = r.GetMemory(32);
                        break;
                    }

                    case 1:     // AuthenticationType
                    {
                        p_authenticationType = (AuthenticationType)r.GetUInt64();
                        break;
                    }

                    case 2:     // KeyExchangeAlgorithms
                    {
                        var length = r.GetUInt32();
                        p_keyExchangeAlgorithms = new KeyExchangeAlgorithm[length];
                        for (int i = 0; i < p_keyExchangeAlgorithms.Length; i++)
                        {
                            p_keyExchangeAlgorithms[i] = (KeyExchangeAlgorithm)r.GetUInt64();
                        }
                        break;
                    }

                    case 3:     // KeyDerivationAlgorithms
                    {
                        var length = r.GetUInt32();
                        p_keyDerivationAlgorithms = new KeyDerivationAlgorithm[length];
                        for (int i = 0; i < p_keyDerivationAlgorithms.Length; i++)
                        {
                            p_keyDerivationAlgorithms[i] = (KeyDerivationAlgorithm)r.GetUInt64();
                        }
                        break;
                    }

                    case 4:     // CryptoAlgorithms
                    {
                        var length = r.GetUInt32();
                        p_cryptoAlgorithms = new CryptoAlgorithm[length];
                        for (int i = 0; i < p_cryptoAlgorithms.Length; i++)
                        {
                            p_cryptoAlgorithms[i] = (CryptoAlgorithm)r.GetUInt64();
                        }
                        break;
                    }

                    case 5:     // HashAlgorithms
                    {
                        var length = r.GetUInt32();
                        p_hashAlgorithms = new HashAlgorithm[length];
                        for (int i = 0; i < p_hashAlgorithms.Length; i++)
                        {
                            p_hashAlgorithms[i] = (HashAlgorithm)r.GetUInt64();
                        }
                        break;
                    }
                    }
                }

                return(new ProfileMessage(p_sessionId, p_authenticationType, p_keyExchangeAlgorithms, p_keyDerivationAlgorithms, p_cryptoAlgorithms, p_hashAlgorithms));
            }