Ejemplo n.º 1
0
        /// <summary>
        /// Constructs a NS record by reading bytes from a return message
        /// </summary>
        /// <param name="pointer">A logical pointer to the bytes holding the record</param>
        public SshFP(Pointer pointer)
        {
            //detect algorithm
            byte a = pointer.ReadByte();
            switch(a)
            {
                case 0: this.algorithm = "Reserved"; break;
                case 1: this.algorithm = "RSA"; break;
                case 2: this.algorithm = "DSS"; break;
                default: this.algorithm = "Unknown"; break;
            }

            //detect fingerprint type
            byte fpt = pointer.ReadByte();
            switch(fpt)
            {
                case 0: this.fingerPrintType = "Reserved"; break;
                case 1: this.fingerPrintType = "RSA-1"; break;
                default: this.fingerPrintType = "Unknown"; break;
            }

            this.fingerPrint = pointer.ReadString();	//read the fingerprint (hex format)
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructs an LOC record by reading bytes from a return message
        /// </summary>
        /// <param name="pointer">A logical pointer to the bytes holding the record</param>
        public Loc(Pointer pointer)
        {
            int referenceAlt = 100000 * 100;
            int latval, longval, altval;

            version = pointer.ReadByte();
            size = pointer.ReadByte();
            hPrecision = pointer.ReadByte();
            vPrecision = pointer.ReadByte();

            latitude = pointer.ReadInt();
            longitude = pointer.ReadInt();
            altitude = pointer.ReadInt();

            latval = latitude - (1 << 31);
            longval = longitude - (1 << 31);

            if (altitude < referenceAlt)
            {
                //below WGS 84 spheroid
                altval = referenceAlt - altitude;
                altsign = -1;
            }
            else
            {
                altval = altitude - referenceAlt;
                altsign = 1;
            }

            if (latval < 0)
            {
                northsouth = 'S';
                latval = -latval;
            }
            else
                northsouth = 'N';

            //latitude calculation
            latsecfrag = latval % 1000;
            latval /= 1000;
            latsec = latval % 60;
            latval /= 60;
            latmin = latval % 60;
            latval /= 60;
            latdeg = latval;

            if (longval < 0)
            {
                eastwest = 'W';
                longval = -longval;
            }
            else
                eastwest = 'E';

            //longitude calculation
            longsecfrag = longval % 1000;
            longval /= 1000;
            longsec = longval % 60;
            longval /= 60;
            longmin = longval % 60;
            longval /= 60;
            longdeg = longval;

            //altitude
            altfrag = altval % 100;
            altmeters = (altval / 100) * altsign;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructs a NS record by reading bytes from a return message
 /// </summary>
 /// <param name="pointer">A logical pointer to the bytes holding the record</param>
 public Txt(Pointer pointer, int length)
 {
     pointer.ReadByte();	//ignore first (NULL) byte
     text = pointer.ReadString(length - 1);
 }