<commit_before>﻿using Flood.RPC.Serialization;
using System;

namespace Flood.RPC
{
    public enum RPCFlags
    {
        None = 0,
        Encrypted = 1,
        Compressed = 2,
        Signed = 4,
    }

    public enum RPCDataType
    {
        Call = 1,
        Reply = 2,
        Exception = 3,
        Oneway = 4
    }

    public struct RPCData
    {
        public struct RPCDataHeader
        {
            Serializer serializer;

            public int ServiceId;
            public int SequenceNumber;
            public RPCDataType CallType;

            public RPCDataHeader(Serializer serializer)
                : this()
            {
                this.serializer = serializer;
            }

            public void Read()
            {
                ServiceId = serializer.ReadI32();
                SequenceNumber = serializer.ReadI32();
                CallType = (RPCDataType)serializer.ReadI32();
            }

            public void Write()
            {
                serializer.WriteI32(ServiceId);
                serializer.WriteI32(SequenceNumber);
                serializer.WriteI32((int)CallType);
            }
        }

        public Serializer Serializer;
        public RPCFlags Flags;
        public RPCPeer Peer;

        public RPCDataHeader Header;

        public RPCData(Serializer serializer)
            : this()
        {
            Serializer = serializer;
            Header = new RPCDataHeader(Serializer);
        }

        public static RPCData CreateReply(RPCData call, RPCFlags flags = RPCFlags.None)
        {
            var serializer = new BinarySerializer();
            var reply = new RPCData(serializer);
            reply.Peer = call.Peer;
            reply.Flags = flags;
            reply.Header.SequenceNumber = call.Header.SequenceNumber;
            reply.Header.CallType = RPCDataType.Reply;
            reply.Header.ServiceId = call.Header.ServiceId;
            reply.Header.Write();

            return reply;
        }<commit_msg>Removed sequenceNumber from RPCData. RPCData now has ImplId and ProxyId.<commit_after>﻿using Flood.RPC.Serialization;
using System;

namespace Flood.RPC
{
    public enum RPCFlags
    {
        None = 0,
        Encrypted = 1,
        Compressed = 2,
        Signed = 4,
    }

    public enum RPCDataType
    {
        Call = 1,
        Reply = 2,
        Exception = 3,
        Oneway = 4
    }

    public struct RPCData
    {
        public struct RPCDataHeader
        {
            Serializer serializer;

            public int ImplId;
            public int ProxyId;
            public RPCDataType CallType;

            public RPCDataHeader(Serializer serializer)
                : this()
            {
                this.serializer = serializer;
            }

            public void Read()
            {
                ImplId = serializer.ReadI32();
                ProxyId = serializer.ReadI32();
                CallType = (RPCDataType)serializer.ReadI32();
            }

            public void Write()
            {
                serializer.WriteI32(ImplId);
                serializer.WriteI32(ProxyId);
                serializer.WriteI32((int)CallType);
            }
        }

        public Serializer Serializer;
        public RPCFlags Flags;
        public RPCPeer Peer;

        public RPCDataHeader Header;

        public RPCData(Serializer serializer)
            : this()
        {
            Serializer = serializer;
            Header = new RPCDataHeader(Serializer);
        }

        public static RPCData CreateReply(RPCData call, RPCFlags flags = RPCFlags.None)
        {
            var serializer = new BinarySerializer();
            var reply = new RPCData(serializer);
            reply.Peer = call.Peer;
            reply.Flags = flags;
            reply.Header.SequenceNumber = call.Header.SequenceNumber;
            reply.Header.CallType = RPCDataType.Reply;
            reply.Header.ServiceId = call.Header.ServiceId;
            reply.Header.Write();

            return reply;
        }
{'fraction_non_alphanumeric': 0.07299630086313194, 'fraction_numerical': 0.009864364981504316, 'mean_word_length': 1.4433734939759035, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2625559', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1031, 'n_words': 241}