Ejemplo n.º 1
0
        public SmppPduBindBase(SmppCommandType commandType, string systemId, string password, string systemType, byte interfaceVersion, byte addrTon, byte addrNpi, string addrRange)
            : base(commandType)
        {
            if (commandType != GetCommandType()) throw new Exception("Invaid command ID");

            if (systemId.Length > 15) throw new ArgumentOutOfRangeException("systemId");
            offsetSystemId = CurrentOffset;
            WriteCString(systemId);

            if (password.Length > 8) throw new ArgumentOutOfRangeException("password");
            offsetPassword = CurrentOffset;
            WriteCString(password);

            if (systemType.Length > 12) throw new ArgumentOutOfRangeException("systemType");
            offsetSystemType = CurrentOffset;
            WriteCString(systemType);

            offsetInterfaceVersion = CurrentOffset;
            WriteByte(interfaceVersion);

            offsetAddrTon = CurrentOffset;
            WriteByte(addrTon);

            offsetAddrNpi = CurrentOffset;
            WriteByte(addrNpi);

            if (addrRange.Length > 40) throw new ArgumentOutOfRangeException("addressRange");
            offsetAddrRange = CurrentOffset;
            WriteCString(addrRange);
        }
Ejemplo n.º 2
0
 protected SmppPdu(SmppCommandType commandType, SmppCommandStatus commandStatus = 0, uint seqNumber = 0)
 {
     data = new MemoryStream();
     WriteInteger((uint)commandType);
     WriteInteger((uint)commandStatus);
     WriteInteger(seqNumber == 0 ? currentSeqNumber++ : seqNumber);
     if (currentSeqNumber > int.MaxValue) currentSeqNumber = 1;
 }
Ejemplo n.º 3
0
        public SmppPduSmRespBase(SmppCommandType commandType, uint sequenceId, SmppCommandStatus status, string messageId)
            : base(commandType, status, sequenceId)
        {
            if (commandType != GetCommandType()) throw new Exception("Invaid command ID");

            if (messageId.Length > 64) throw new ArgumentOutOfRangeException("messageId");
            offsetMessageId = CurrentOffset;
            WriteCString(messageId);
        }
Ejemplo n.º 4
0
 protected SmppPdu(SmppCommandType commandType, SmppCommandStatus commandStatus = 0, uint seqNumber = 0)
 {
     data = new MemoryStream();
     WriteInteger((uint)commandType);
     WriteInteger((uint)commandStatus);
     WriteInteger(seqNumber == 0 ? currentSeqNumber++ : seqNumber);
     if (currentSeqNumber > int.MaxValue)
     {
         currentSeqNumber = 1;
     }
 }
        public SmppPduBindRespBase(SmppCommandType commandType, uint sequenceId, SmppCommandStatus status, string systemId, SmppOptionalParameter[] optionalParameters = null)
            : base(commandType, status, sequenceId)
        {
            if (commandType != GetCommandType()) throw new Exception("Invaid command ID");

            if (systemId.Length > 15) throw new ArgumentOutOfRangeException("systemId");
            offsetSystemId = CurrentOffset;
            WriteCString(systemId);

            offsetOptionalParameters = CurrentOffset;
            if (optionalParameters != null)
                WriteOptionalParameters(optionalParameters);
        }
Ejemplo n.º 6
0
        public SmppPduSmRespBase(SmppCommandType commandType, uint sequenceId, SmppCommandStatus status, string messageId)
            : base(commandType, status, sequenceId)
        {
            if (commandType != GetCommandType())
            {
                throw new Exception("Invaid command ID");
            }

            if (messageId.Length > 64)
            {
                throw new ArgumentOutOfRangeException("messageId");
            }
            offsetMessageId = CurrentOffset;
            WriteCString(messageId);
        }
Ejemplo n.º 7
0
        public SmppPduBindBase(SmppCommandType commandType, string systemId, string password, string systemType, byte interfaceVersion, byte addrTon, byte addrNpi, string addrRange)
            : base(commandType)
        {
            if (commandType != GetCommandType())
            {
                throw new Exception("Invaid command ID");
            }

            if (systemId.Length > 15)
            {
                throw new ArgumentOutOfRangeException("systemId");
            }
            offsetSystemId = CurrentOffset;
            WriteCString(systemId);

            if (password.Length > 8)
            {
                throw new ArgumentOutOfRangeException("password");
            }
            offsetPassword = CurrentOffset;
            WriteCString(password);

            if (systemType.Length > 12)
            {
                throw new ArgumentOutOfRangeException("systemType");
            }
            offsetSystemType = CurrentOffset;
            WriteCString(systemType);

            offsetInterfaceVersion = CurrentOffset;
            WriteByte(interfaceVersion);

            offsetAddrTon = CurrentOffset;
            WriteByte(addrTon);

            offsetAddrNpi = CurrentOffset;
            WriteByte(addrNpi);

            if (addrRange.Length > 40)
            {
                throw new ArgumentOutOfRangeException("addressRange");
            }
            offsetAddrRange = CurrentOffset;
            WriteCString(addrRange);
        }
        public SmppPduBindRespBase(SmppCommandType commandType, uint sequenceId, SmppCommandStatus status, string systemId, SmppOptionalParameter[] optionalParameters = null)
            : base(commandType, status, sequenceId)
        {
            if (commandType != GetCommandType())
            {
                throw new Exception("Invaid command ID");
            }

            if (systemId.Length > 15)
            {
                throw new ArgumentOutOfRangeException("systemId");
            }
            offsetSystemId = CurrentOffset;
            WriteCString(systemId);

            offsetOptionalParameters = CurrentOffset;
            if (optionalParameters != null)
            {
                WriteOptionalParameters(optionalParameters);
            }
        }
Ejemplo n.º 9
0
        public SmppPduSmBase(SmppCommandType commandType, string serviceType, byte sourceAddrTon, byte sourceAddrNpi, string sourceAddr, byte destAddrTon, byte destAddrNpi, string destAddr,
            byte esmClass, byte protocolId, byte priorityFlag, string scheduleDeliveryTime, string validityPeriod, byte registeredDelivery, byte replaceIfPresentFlag,
            byte dataCoding, byte smDefaultMsgId, /*byte smLength,*/ string shortMessage, SmppOptionalParameter[] optionalParameters = null)
            : base(commandType)
        {
            if (commandType != GetCommandType()) throw new Exception("Invaid command ID");

            if (serviceType.Length > 5) throw new ArgumentOutOfRangeException("systemType");
            offsetServiceType = CurrentOffset;
            WriteCString(serviceType);

            offsetSourceAddrTon = CurrentOffset;
            WriteByte(sourceAddrTon);

            offsetSourceAddrNpi = CurrentOffset;
            WriteByte(sourceAddrNpi);

            if (sourceAddr.Length > 20) throw new ArgumentOutOfRangeException("sourceAddr");
            offsetSourceAddr = CurrentOffset;
            WriteCString(sourceAddr);

            offsetDestAddrTon = CurrentOffset;
            WriteByte(destAddrTon);

            offsetDestAddrNpi = CurrentOffset;
            WriteByte(destAddrNpi);

            if (destAddr.Length > 20) throw new ArgumentOutOfRangeException("destAddr");
            offsetDestAddr = CurrentOffset;
            WriteCString(destAddr);

            offsetEsmClass = CurrentOffset;
            WriteByte(esmClass);

            offsetProtocolId = CurrentOffset;
            WriteByte(protocolId);

            offsetPriorityFlag = CurrentOffset;
            WriteByte(priorityFlag);

            if (scheduleDeliveryTime.Length != 0 && scheduleDeliveryTime.Length != 16) throw new ArgumentOutOfRangeException("scheduleDeliveryTime");
            offsetScheduleDeliveryTime = CurrentOffset;
            WriteCString(scheduleDeliveryTime);

            if (validityPeriod.Length != 0 && validityPeriod.Length != 16) throw new ArgumentOutOfRangeException("validityPeriod");
            offsetValidityPeriod = CurrentOffset;
            WriteCString(validityPeriod);

            offsetRegisteredDelivery = CurrentOffset;
            WriteByte(registeredDelivery);

            offsetReplaceIfPresentFlag = CurrentOffset;
            WriteByte(replaceIfPresentFlag);

            offsetDataCoding = CurrentOffset;
            WriteByte(dataCoding);

            offsetSmDefaultMsgId = CurrentOffset;
            WriteByte(smDefaultMsgId);

            if (DataEncoder.GetByteCount(shortMessage) > 254) throw new ArgumentOutOfRangeException("smLength");
            offsetSmLength = CurrentOffset;
            WriteByte((byte)DataEncoder.GetByteCount(shortMessage));

            offsetShortMessage = CurrentOffset;
            WriteString(shortMessage, (byte)DataEncoder.GetByteCount(shortMessage), DataEncoder);

            offsetOptionalParameters = CurrentOffset;
            if (optionalParameters != null)
                WriteOptionalParameters(optionalParameters);
        }
Ejemplo n.º 10
0
        public SmppPduSmBase(SmppCommandType commandType, string serviceType, byte sourceAddrTon, byte sourceAddrNpi, string sourceAddr, byte destAddrTon, byte destAddrNpi, string destAddr,
                             byte esmClass, byte protocolId, byte priorityFlag, string scheduleDeliveryTime, string validityPeriod, byte registeredDelivery, byte replaceIfPresentFlag,
                             byte dataCoding, byte smDefaultMsgId, /*byte smLength,*/ string shortMessage, SmppOptionalParameter[] optionalParameters = null)
            : base(commandType)
        {
            if (commandType != GetCommandType())
            {
                throw new Exception("Invaid command ID");
            }

            if (serviceType.Length > 5)
            {
                throw new ArgumentOutOfRangeException("systemType");
            }
            offsetServiceType = CurrentOffset;
            WriteCString(serviceType);

            offsetSourceAddrTon = CurrentOffset;
            WriteByte(sourceAddrTon);

            offsetSourceAddrNpi = CurrentOffset;
            WriteByte(sourceAddrNpi);

            if (sourceAddr.Length > 20)
            {
                throw new ArgumentOutOfRangeException("sourceAddr");
            }
            offsetSourceAddr = CurrentOffset;
            WriteCString(sourceAddr);

            offsetDestAddrTon = CurrentOffset;
            WriteByte(destAddrTon);

            offsetDestAddrNpi = CurrentOffset;
            WriteByte(destAddrNpi);

            if (destAddr.Length > 20)
            {
                throw new ArgumentOutOfRangeException("destAddr");
            }
            offsetDestAddr = CurrentOffset;
            WriteCString(destAddr);

            offsetEsmClass = CurrentOffset;
            WriteByte(esmClass);

            offsetProtocolId = CurrentOffset;
            WriteByte(protocolId);

            offsetPriorityFlag = CurrentOffset;
            WriteByte(priorityFlag);

            if (scheduleDeliveryTime.Length != 0 && scheduleDeliveryTime.Length != 16)
            {
                throw new ArgumentOutOfRangeException("scheduleDeliveryTime");
            }
            offsetScheduleDeliveryTime = CurrentOffset;
            WriteCString(scheduleDeliveryTime);

            if (validityPeriod.Length != 0 && validityPeriod.Length != 16)
            {
                throw new ArgumentOutOfRangeException("validityPeriod");
            }
            offsetValidityPeriod = CurrentOffset;
            WriteCString(validityPeriod);

            offsetRegisteredDelivery = CurrentOffset;
            WriteByte(registeredDelivery);

            offsetReplaceIfPresentFlag = CurrentOffset;
            WriteByte(replaceIfPresentFlag);

            offsetDataCoding = CurrentOffset;
            WriteByte(dataCoding);

            offsetSmDefaultMsgId = CurrentOffset;
            WriteByte(smDefaultMsgId);

            if (DataEncoder.GetByteCount(shortMessage) > 254)
            {
                throw new ArgumentOutOfRangeException("smLength");
            }
            offsetSmLength = CurrentOffset;
            WriteByte((byte)DataEncoder.GetByteCount(shortMessage));

            offsetShortMessage = CurrentOffset;
            WriteString(shortMessage, (byte)DataEncoder.GetByteCount(shortMessage), DataEncoder);

            offsetOptionalParameters = CurrentOffset;
            if (optionalParameters != null)
            {
                WriteOptionalParameters(optionalParameters);
            }
        }