예제 #1
0
            public static SCPStatementPledges Decode(XdrDataInputStream stream)
            {
                SCPStatementPledges decodedSCPStatementPledges = new SCPStatementPledges();
                SCPStatementType    discriminant = SCPStatementType.Decode(stream);

                decodedSCPStatementPledges.Discriminant = discriminant;
                switch (decodedSCPStatementPledges.Discriminant.InnerValue)
                {
                case SCPStatementType.SCPStatementTypeEnum.SCP_ST_PREPARE:
                    decodedSCPStatementPledges.Prepare = SCPStatementPrepare.Decode(stream);
                    break;

                case SCPStatementType.SCPStatementTypeEnum.SCP_ST_CONFIRM:
                    decodedSCPStatementPledges.Confirm = SCPStatementConfirm.Decode(stream);
                    break;

                case SCPStatementType.SCPStatementTypeEnum.SCP_ST_EXTERNALIZE:
                    decodedSCPStatementPledges.Externalize = SCPStatementExternalize.Decode(stream);
                    break;

                case SCPStatementType.SCPStatementTypeEnum.SCP_ST_NOMINATE:
                    decodedSCPStatementPledges.Nominate = SCPNomination.Decode(stream);
                    break;
                }
                return(decodedSCPStatementPledges);
            }
 public static void Encode(XdrDataOutputStream stream,
                           SCPStatementExternalize encodedSCPStatementExternalize)
 {
     SCPBallot.Encode(stream, encodedSCPStatementExternalize.Commit);
     Uint32.Encode(stream, encodedSCPStatementExternalize.NH);
     Hash.Encode(stream, encodedSCPStatementExternalize.CommitQuorumSetHash);
 }
예제 #3
0
                public static SCPStatementExternalize Decode(XdrDataInputStream stream)
                {
                    SCPStatementExternalize decodedSCPStatementExternalize = new SCPStatementExternalize();

                    decodedSCPStatementExternalize.Commit = SCPBallot.Decode(stream);
                    decodedSCPStatementExternalize.NH     = Uint32.Decode(stream);
                    decodedSCPStatementExternalize.CommitQuorumSetHash = Hash.Decode(stream);
                    return(decodedSCPStatementExternalize);
                }
예제 #4
0
            public static void Encode(XdrDataOutputStream stream, SCPStatementPledges encodedSCPStatementPledges)
            {
                stream.WriteInt((int)encodedSCPStatementPledges.Discriminant.InnerValue);
                switch (encodedSCPStatementPledges.Discriminant.InnerValue)
                {
                case SCPStatementType.SCPStatementTypeEnum.SCP_ST_PREPARE:
                    SCPStatementPrepare.Encode(stream, encodedSCPStatementPledges.Prepare);
                    break;

                case SCPStatementType.SCPStatementTypeEnum.SCP_ST_CONFIRM:
                    SCPStatementConfirm.Encode(stream, encodedSCPStatementPledges.Confirm);
                    break;

                case SCPStatementType.SCPStatementTypeEnum.SCP_ST_EXTERNALIZE:
                    SCPStatementExternalize.Encode(stream, encodedSCPStatementPledges.Externalize);
                    break;

                case SCPStatementType.SCPStatementTypeEnum.SCP_ST_NOMINATE:
                    SCPNomination.Encode(stream, encodedSCPStatementPledges.Nominate);
                    break;
                }
            }
 public static SCPStatementExternalize Decode(IByteReader stream) {
   SCPStatementExternalize decodedSCPStatementExternalize = new SCPStatementExternalize();
   decodedSCPStatementExternalize.Commit = SCPBallot.Decode(stream);
   decodedSCPStatementExternalize.NH = Uint32.Decode(stream);
   decodedSCPStatementExternalize.CommitQuorumSetHash = Hash.Decode(stream);
   return decodedSCPStatementExternalize;
 }
 public static void Encode(IByteWriter stream, SCPStatementExternalize encodedSCPStatementExternalize) {
   SCPBallot.Encode(stream, encodedSCPStatementExternalize.Commit);
   Uint32.Encode(stream, encodedSCPStatementExternalize.NH);
   Hash.Encode(stream, encodedSCPStatementExternalize.CommitQuorumSetHash);
 }
예제 #7
0
 public static void Encode(IByteWriter stream, SCPStatementExternalize encodedSCPStatementExternalize)
 {
     SCPBallot.Encode(stream, encodedSCPStatementExternalize.Commit);
     Uint32.Encode(stream, encodedSCPStatementExternalize.NH);
     Hash.Encode(stream, encodedSCPStatementExternalize.CommitQuorumSetHash);
 }