Exemplo 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));
            }
Exemplo n.º 2
0
            public OmniSignature 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;
                OmniHash p_hash = OmniHash.Empty;

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

                    case 1:     // Hash
                    {
                        p_hash = OmniHash.Formatter.Deserialize(r, rank + 1);
                        break;
                    }
                    }
                }

                return(new OmniSignature(p_name, p_hash));
            }
Exemplo 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));
            }
Exemplo n.º 4
0
            public VerificationMessage Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

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

                ProfileMessage         p_profileMessage     = ProfileMessage.Empty;
                OmniAgreementPublicKey p_agreementPublicKey = OmniAgreementPublicKey.Empty;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // ProfileMessage
                    {
                        p_profileMessage = ProfileMessage.Formatter.Deserialize(r, rank + 1);
                        break;
                    }

                    case 1:     // AgreementPublicKey
                    {
                        p_agreementPublicKey = OmniAgreementPublicKey.Formatter.Deserialize(r, rank + 1);
                        break;
                    }
                    }
                }

                return(new VerificationMessage(p_profileMessage, p_agreementPublicKey));
            }
Exemplo n.º 5
0
            public AuthenticationMessage 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_hashes = System.Array.Empty <System.ReadOnlyMemory <byte> >();

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // Hashes
                    {
                        var length = r.GetUInt32();
                        p_hashes = new System.ReadOnlyMemory <byte> [length];
                        for (int i = 0; i < p_hashes.Length; i++)
                        {
                            p_hashes[i] = r.GetMemory(32);
                        }
                        break;
                    }
                    }
                }

                return(new AuthenticationMessage(p_hashes));
            }
Exemplo n.º 6
0
            public OmniAddress Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

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

                string p_value = string.Empty;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // Value
                    {
                        p_value = r.GetString(8192);
                        break;
                    }
                    }
                }

                return(new OmniAddress(p_value));
            }
Exemplo n.º 7
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));
            }
Exemplo n.º 8
0
            public ThumbnailsCache Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

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

                Thumbnail[] p_thumbnails = System.Array.Empty <Thumbnail>();

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // Thumbnails
                    {
                        var length = r.GetUInt32();
                        p_thumbnails = new Thumbnail[length];
                        for (int i = 0; i < p_thumbnails.Length; i++)
                        {
                            p_thumbnails[i] = Thumbnail.Formatter.Deserialize(r, rank + 1);
                        }
                        break;
                    }
                    }
                }

                return(new ThumbnailsCache(p_thumbnails));
            }
Exemplo n.º 9
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));
            }
Exemplo n.º 10
0
            public Thumbnail Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

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

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

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // Value
                    {
                        p_value = r.GetRecyclableMemory(33554432);
                        break;
                    }
                    }
                }

                return(new Thumbnail(p_value));
            }
Exemplo n.º 11
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));
            }
Exemplo n.º 12
0
            public LxnaOptions Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

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

                string p_configDirectoryPath = string.Empty;

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

                return(new LxnaOptions(p_configDirectoryPath));
            }
Exemplo n.º 13
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));
            }
Exemplo n.º 14
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));
            }
Exemplo n.º 15
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));
            }
Exemplo n.º 16
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));
            }
Exemplo n.º 17
0
            public OmniRpcErrorMessage Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

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

                string p_type       = string.Empty;
                string p_message    = string.Empty;
                string p_stackTrace = string.Empty;

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

                    case 1:     // Message
                    {
                        p_message = r.GetString(8192);
                        break;
                    }

                    case 2:     // StackTrace
                    {
                        p_stackTrace = r.GetString(8192);
                        break;
                    }
                    }
                }

                return(new OmniRpcErrorMessage(p_type, p_message, p_stackTrace));
            }
Exemplo n.º 18
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));
            }