Ejemplo n.º 1
0
        /// <summary>
        /// Creates an Unsuccess address.  This will trim down the address given to
        /// it for use in future operations.
        /// </summary>
        /// <param name="address">The bytes of the response.</param>
        public UnsuccessAddress(ref byte[] address)
        {
            _destinationAddressTon = (Pdu.TonType)address[0];
            _destinationAddressNpi = (Pdu.NpiType)address[1];
            _destinationAddress    = SmppStringUtil.GetCStringFromBody(ref address, 2);
            //convert error status to host order
            _errorStatusCode = UnsignedNumConverter.SwapByteOrdering(
                BitConverter.ToUInt32(address, 0));
            //now we have to trim off four octets to account for the status code
            long length = address.Length - 4;

            byte[] newRemainder = new byte[length];
            Array.Copy(address, 4, newRemainder, 0, length);
            //and change the reference
            address      = newRemainder;
            newRemainder = null;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates an DestinationAddress address.  This will trim down the address given to
        /// it for use in future operations.
        /// </summary>
        /// <param name="address">The bytes of the response.</param>
        public DestinationAddress(ref byte[] address)
        {
            if (address[0] == 0x01)
            {
                _IsDistributionList = false;
            }
            else if (address[0] == 0x02)
            {
                _IsDistributionList = true;
            }
            else
            {
                throw new ApplicationException("Unable to determine type of destination address");
            }

            if (!IsDistributionList)
            {
                _DestinationAddressTon = (Pdu.TonType)address[1];
                _DestinationAddressNpi = (Pdu.NpiType)address[2];
                _DestinationAddress    = SmppStringUtil.GetCStringFromBody(ref address, 3);
//
//				long length = address.Length - 4;
//				byte[] newRemainder = new byte[length];
//				Array.Copy(address, 4, newRemainder, 0, length);
//				//and change the reference
//				address = newRemainder;
//				newRemainder = null;
            }
            else
            {
                _DistributionList = SmppStringUtil.GetCStringFromBody(ref address, 1);
//
//				long length = address.Length - 4;
//				byte[] newRemainder = new byte[length];
//				Array.Copy(address, 4, newRemainder, 0, length);
//				//and change the reference
//				address = newRemainder;
//				newRemainder = null;
            }
        }