public Member(string __userName, byte[] __password, PublicUserInfo pubInfo, PrivateUserInfo privInfo, Node __node)
 {
     userName = __userName;
     password = __password;
     publicUserInfo = pubInfo;
     privateUserInfo = privInfo;
     node = __node;
 }
 public User(RingInfo[] __ringsInfo, PublicUserInfo __publicUserInfo, PrivateUserInfo __privateUserInfo, Node __node)
 {
     ringsInfo = __ringsInfo;
     publicUserInfo = __publicUserInfo;
     privateUserInfo = __privateUserInfo;
     node = __node;
     loggedIn = false;
 }
 public void distributeQuery(string[] columnsToSearch, string[] query, Node sender, int ttl)
 {
     //Determine best choice neighbors
     Neighbor[] bestChoiceNeighbors = determineBestChoiceNeighbors(query);
     //Send out query to each best choice neighbor
     foreach (Neighbor neighbor in bestChoiceNeighbors)
     {
         if (neighbor == null)
             break;;
         neighbor.neighborProxy.sendQuery(neighbor.peer, this, columnsToSearch, query, sender,
             ttl);
     }
 }
        public void sendQuery(Peer neighbor, RingInfo ringInfo, string[] columns, string[] query, 
            Node sender, int ttl)
        {
            byte[] message = new byte[Constants.WRITEBUFFSIZE];
            MemoryStream stream;

            if (ttl <= 0)
                return;

            try
            {
                BinaryFormatter serializer = new BinaryFormatter();
                stream = new MemoryStream(message);

                NetLib.insertEntropyHeader(serializer, stream);

                if (columns == null)
                    serializer.Serialize(stream, Constants.MessageTypes.MSG_SIMPLEQUERY);
                else
                    serializer.Serialize(stream, Constants.MessageTypes.MSG_COLUMNQUERY);

                serializer.Serialize(stream, ringInfo.token);
                serializer.Serialize(stream, ringInfo.ring.ringID);
                serializer.Serialize(stream, sender.asyncCommunicationPoint);
                serializer.Serialize(stream, ttl);  //TTL
                if (columns == null)
                    serializer.Serialize(stream, Constants.NULL_STRING_ARRAY);
                else
                    serializer.Serialize(stream, columns);
                serializer.Serialize(stream, query);

                NetLib.communicateAsync(neighbor.node.asyncCommunicationPoint, message, false);
            }
            catch (Exception e)
            {
                int x = 2;  //REVISIT: probably need to send info to logger.
            }
        }
 public Peer(Node __node, PublicUserInfo __userInfo, InformationEntropy[] __IE)
 {
     node = __node;
     userInfo = __userInfo;
     IE = __IE;
 }