コード例 #1
0
ファイル: BindRequest.cs プロジェクト: Primayer/JamaaSMPP
        protected override void Parse(ByteBuffer buffer)
        {
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer");
            }
            const int minBytes = 7;

            if (buffer.Length < minBytes)
            {
                throw new NotEnoughBytesException("BindRequest requires at least 7 bytes for body parameters");
            }
            try
            {
                vSystemID         = DecodeCString(buffer);
                vPassword         = DecodeCString(buffer);
                vSystemType       = DecodeCString(buffer);
                vInterfaceVersion = GetByte(buffer);
                vAddressTon       = (TypeOfNumber)GetByte(buffer);
                vAddressNpi       = (NumberingPlanIndicator)GetByte(buffer);
                vAddressRange     = DecodeCString(buffer);
            }
            catch (InvalidOperationException ex)
            {
                //ByteBuffer.Remove() throws InvalidOperationException exception if called on a empty ByteBuffer instance
                //Wrap this exception as a NotEnoughBytesException exception
                throw new NotEnoughBytesException(ex.Message, ex);
            }
            if (buffer.Length > 0) //If there are some bytes left
            {
                throw new TooManyBytesException();
            }
        }
コード例 #2
0
ファイル: BindRequest.cs プロジェクト: neoxack/JamaaSMPP
 internal BindRequest(PduHeader header)
     : base(header)
 {
     _vSystemId         = "";
     _vPassword         = "";
     _vSystemType       = "";
     _vAddressTon       = TypeOfNumber.International;  //International
     _vAddressNpi       = NumberingPlanIndicator.Isdn; //ISDN
     _vInterfaceVersion = 34;                          //SMPP 3.4 version
     _vAddressRange     = "";
 }
コード例 #3
0
ファイル: BindRequest.cs プロジェクト: James226/SMSWeb
 internal BindRequest(PDUHeader header)
     : base(header)
 {
     vSystemID = "";
     vPassword = "";
     vSystemType = "";
     vAddressTon = TypeOfNumber.International; //International
     vAddressNpi = NumberingPlanIndicator.ISDN; //ISDN
     vInterfaceVersion = 34; //SMPP 3.4 version
     vAddressRange = "";
 }
コード例 #4
0
ファイル: BindRequest.cs プロジェクト: Primayer/JamaaSMPP
 internal BindRequest(PDUHeader header)
     : base(header)
 {
     vSystemID         = "";
     vPassword         = "";
     vSystemType       = "";
     vAddressTon       = TypeOfNumber.International;  //International
     vAddressNpi       = NumberingPlanIndicator.ISDN; //ISDN
     vInterfaceVersion = 34;                          //SMPP 3.4 version
     vAddressRange     = "";
 }
コード例 #5
0
ファイル: SessionBindInfo.cs プロジェクト: James226/SMSWeb
 public SessionBindInfo()
 {
     vHost = "";
     vSystemID = "";
     vPassword = "";
     vSystemType = "";
     vInterfaceVersion = InterfaceVersion.v34;
     vAllowReceive = true;
     vAllowTransmit = true;
     vAddressTon = TypeOfNumber.International;
     vAddressNpi = NumberingPlanIndicator.ISDN;
 }
コード例 #6
0
 public SessionBindInfo()
 {
     _vHost             = "";
     _vSystemId         = "";
     _vPassword         = "";
     _vSystemType       = "";
     _vInterfaceVersion = InterfaceVersion.V34;
     _vAllowReceive     = true;
     _vAllowTransmit    = true;
     _vAddressTon       = TypeOfNumber.International;
     _vAddressNpi       = NumberingPlanIndicator.Isdn;
 }
コード例 #7
0
 public SessionBindInfo()
 {
     vHost             = "";
     vSystemID         = "";
     vPassword         = "";
     vSystemType       = "";
     vInterfaceVersion = InterfaceVersion.v34;
     vAllowReceive     = true;
     vAllowTransmit    = true;
     vAddressTon       = TypeOfNumber.International;
     vAddressNpi       = NumberingPlanIndicator.ISDN;
 }
コード例 #8
0
        internal static SmppAddress Parse(ByteBuffer buffer)
        {
            //We require at least 3 bytes for SMPPAddress instance to be craeted
            if (buffer.Length < 3)
            {
                throw new NotEnoughBytesException("SMPPAddress requires at least 3 bytes");
            }
            TypeOfNumber           ton = (TypeOfNumber)PDU.GetByte(buffer);
            NumberingPlanIndicator npi = (NumberingPlanIndicator)PDU.GetByte(buffer);
            string address             = PDU.DecodeCString(buffer);

            return(new SmppAddress(ton, npi, address));
        }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of <see cref="SmppConnectionProperties"/>
 /// </summary>
 public SmppConnectionProperties()
 {
     vSystemID = "";
     vPassword = "";
     vHost = "";
     vAddressTon = TypeOfNumber.International;
     vAddressNpi = NumberingPlanIndicator.ISDN;
     vInterfaceVersion = InterfaceVersion.v34;
     vSystemType = "";
     vDefaultServiceType = "";
     SmscID = "";
     vSyncRoot = new object();
 }
コード例 #10
0
 /// <summary>
 /// Initializes a new instance of <see cref="SmppConnectionProperties"/>
 /// </summary>
 public SmppConnectionProperties()
 {
     _vSystemId           = "";
     _vPassword           = "";
     _vHost               = "";
     _vAddressTon         = TypeOfNumber.International;
     _vAddressNpi         = NumberingPlanIndicator.Isdn;
     _vInterfaceVersion   = InterfaceVersion.V34;
     _vSystemType         = "";
     _vDefaultServiceType = "";
     SmscId               = "";
     _vSyncRoot           = new object();
 }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of <see cref="SmppConnectionProperties"/>
 /// </summary>
 public SmppConnectionProperties()
 {
     vSystemID           = "";
     vPassword           = "";
     vHost               = "";
     vAddressTon         = TypeOfNumber.International;
     vAddressNpi         = NumberingPlanIndicator.ISDN;
     vInterfaceVersion   = InterfaceVersion.v34;
     vSystemType         = "";
     vDefaultServiceType = "";
     SmscID              = "";
     vSyncRoot           = new object();
 }
コード例 #12
0
        private void BindSession(SessionBindInfo bindInfo, int timeOut)
        {
            _vTcpIpSession.SessionClosed += TcpIpSessionClosedEventHandler;

            BindRequest bindReq = bindInfo.CreatePdu();

            _vTrans.Send(bindReq);
            BindResponse bindResp = null;

            try { bindResp = (BindResponse)_vRespHandler.WaitResponse(bindReq, timeOut); }
            catch (SmppResponseTimedOutException ex)
            { throw new SmppBindException(ex); }
            if (bindResp.Header.ErrorCode != 0)
            {
                throw new SmppBindException(bindResp.Header.ErrorCode);
            }
            //Copy settings
            _vSmscId     = bindResp.SystemId;
            _vSystemId   = bindInfo.SystemId;
            _vPassword   = bindInfo.Password;
            _vAddressTon = bindInfo.AddressTon;
            _vAddressNpi = bindInfo.AddressNpi;
            //Start timer
            _vTimer.Start();
            _vIsAlive = true;
            switch (bindReq.Header.CommandType)
            {
            case CommandType.BindTransceiver:
                ChangeState(SmppSessionState.Transceiver);
                break;

            case CommandType.BindReceiver:
                ChangeState(SmppSessionState.Receiver);
                break;

            case CommandType.BindTransmitter:
                ChangeState(SmppSessionState.Transmitter);
                break;
            }
        }
コード例 #13
0
ファイル: SmppAddress.cs プロジェクト: neoxack/JamaaSMPP
 public SmppAddress()
 {
     _vTon     = TypeOfNumber.International;
     _vNpi     = NumberingPlanIndicator.Isdn;
     _vAddress = "";
 }
コード例 #14
0
ファイル: BindRequest.cs プロジェクト: James226/SMSWeb
 protected override void Parse(ByteBuffer buffer)
 {
     if (buffer == null) { throw new ArgumentNullException("buffer"); }
     const int minBytes = 7;
     if (buffer.Length < minBytes) { throw new NotEnoughBytesException("BindRequest requires at least 7 bytes for body parameters"); }
     try
     {
         vSystemID = DecodeCString(buffer);
         vPassword = DecodeCString(buffer);
         vSystemType = DecodeCString(buffer);
         vInterfaceVersion = GetByte(buffer);
         vAddressTon = (TypeOfNumber)GetByte(buffer);
         vAddressNpi = (NumberingPlanIndicator)GetByte(buffer);
         vAddressRange = DecodeCString(buffer);
     }
     catch (InvalidOperationException ex)
     {
         //ByteBuffer.Remove() throws InvalidOperationException exception if called on a empty ByteBuffer instance
         //Wrap this exception as a NotEnoughBytesException exception
         throw new NotEnoughBytesException(ex.Message,ex);
     }
     if (buffer.Length > 0) //If there are some bytes left
     { throw new TooManyBytesException(); }
 }
コード例 #15
0
 public SmppAddress()
 {
     vTon     = TypeOfNumber.International;
     vNpi     = NumberingPlanIndicator.ISDN;
     vAddress = "";
 }
コード例 #16
0
 public SmppAddress(TypeOfNumber ton, NumberingPlanIndicator npi, string address)
 {
     vTon     = ton;
     vNpi     = npi;
     vAddress = address;
 }
コード例 #17
0
ファイル: SmppAddress.cs プロジェクト: James226/SMSWeb
 public SmppAddress(TypeOfNumber ton, NumberingPlanIndicator npi, string address)
 {
     vTon = ton;
     vNpi = npi;
     vAddress = address;
 }
コード例 #18
0
ファイル: SmppAddress.cs プロジェクト: James226/SMSWeb
 public SmppAddress()
 {
     vTon = TypeOfNumber.International;
     vNpi = NumberingPlanIndicator.ISDN;
     vAddress = "";
 }