/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="commandStatus"></param> /// <param name="sequence"></param> /// <param name="messageId"></param> private SubmitMultiSmResp(DataCodings defaultEncoding, CommandStatus commandStatus, uint sequence, string messageId) : base(defaultEncoding, CommandSet.SubmitMultiSmResp, commandStatus, sequence) { MessageId = messageId; UnsuccessDestinationAddresses = new List <UnsuccessDestinationAddress>(); Optional = new TLVCollection(); }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="status"></param> /// <param name="sequence"></param> private GenericNackSm(DataCodings defaultEncoding, CommandStatus status, uint sequence) : base(defaultEncoding) { Length = (uint)Header.HEADER_LENGTH; Command = CommandSet.GenericNack; Status = status; Sequence = sequence; }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> private SubmitSm(DataCodings defaultEncoding) : base(defaultEncoding, CommandSet.SubmitSm, SequenceGenerator.Counter) { Optional = new TLVCollection(); ValidityPeriod = DateTime.Now.AddDays(2).ToString("yyMMddhhmmss000+"); UserData = UserData.Create(); }
/// <summary> Called to create a DeliverSmResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="commandStatus"></param> /// <returns> DeliverSmResp </returns> internal static DeliverSmResp Create(DataCodings defaultEncoding, CommandStatus commandStatus) { return(new DeliverSmResp(defaultEncoding, commandStatus, 0)); }
/// <summary> Called to create a DataSmResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="status"></param> /// <returns> DataSmResp </returns> internal static DataSmResp Create(DataCodings defaultEncoding, CommandStatus status) { return(new DataSmResp(defaultEncoding, status, 0)); }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> public SmppBuffer(DataCodings defaultEncoding, byte[] buf) { DefaultEncoding = defaultEncoding; ListBuffer = new List<byte>(); ListBuffer.AddRange(buf); }
/// <summary> Called to create a DeliverSmResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> DeliverSmResp </returns> public static DeliverSmResp Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { DeliverSmResp deliverSmResp = new DeliverSmResp(defaultEncoding); try { int start_offset = offset; buf.ExtractHeader(deliverSmResp, ref offset); if (deliverSmResp.Length > Header.HEADER_LENGTH) { deliverSmResp.MessageId = buf.ExtractCString(ref offset); while (offset - start_offset < deliverSmResp.Length) { deliverSmResp.Optional.Add(buf.ExtractTLV(ref offset)); } } } catch { deliverSmResp = null; } return(deliverSmResp); }
/// <summary> Called to create a PduBind object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> BindSm </returns> public static BindSm Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { BindSm bindSm = new BindSm(defaultEncoding); try { int start_offset = offset; buf.ExtractHeader(bindSm, ref offset); bindSm.SystemId = buf.ExtractCString(ref offset); bindSm.Password = buf.ExtractCString(ref offset); bindSm.SystemType = buf.ExtractCString(ref offset); bindSm.InterfaceVersion = buf.ExtractByte(ref offset); bindSm.AddrTon = buf.ExtractByte(ref offset); bindSm.AddrNpi = buf.ExtractByte(ref offset); bindSm.AddressRange = buf.ExtractCString(ref offset); } catch { bindSm = null; } return(bindSm); }
/// <summary> Called to create a SubmitSmResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> SubmitSmResp </returns> public static SubmitSmResp Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { var submitSmResp = new SubmitSmResp(defaultEncoding); try { var start_offset = offset; buf.ExtractHeader(submitSmResp, ref offset); if (submitSmResp.Length > HEADER_LENGTH) { submitSmResp.MessageId = buf.ExtractCString(ref offset); while (offset - start_offset < submitSmResp.Length) { submitSmResp.Optional.Add(buf.ExtractTLV(ref offset)); } } } catch { submitSmResp = null; } return(submitSmResp); }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="commandSet"></param> /// <param name="commandStatus"></param> /// <param name="sequence"></param> /// <param name="systemId"></param> private BindSmResp(DataCodings defaultEncoding, CommandSet commandSet, CommandStatus commandStatus, uint sequence, string systemId) : base(defaultEncoding, commandSet, commandStatus, sequence) { SystemId = systemId; Optional = new TLVCollection(); /* * // Optional Parameter for the Version * int version = 0x34; * byte[] b = System.BitConverter.GetBytes(version); * * if (System.BitConverter.IsLittleEndian) * { * byte tmp = b[0]; * b[0] = b[3]; * b[3] = tmp; * * tmp = b[1]; * b[1] = b[2]; * b[2] = tmp; * } * * Optional.Add(TLV.Create(OptionalTags.SCInterfaceVersion, Convert.ToUInt16(b.Length), b)); */ }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="messageId"></param> /// <param name="sourceTon"></param> /// <param name="sourceNpi"></param> /// <param name="sourceAddr"></param> private QuerySm(DataCodings defaultEncoding, string messageId, byte sourceTon, byte sourceNpi, string sourceAddr) : base(defaultEncoding, CommandSet.QuerySm, SequenceGenerator.Counter) { MessageId = messageId; SourceTon = sourceTon; SourceNpi = sourceNpi; SourceAddr = sourceAddr; }
/// <summary> Called to create a AlertNotification object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> AlertNotification </returns> public static AlertNotification Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { AlertNotification alertNotification = new AlertNotification(defaultEncoding); try { int start_offset = offset; buf.ExtractHeader(alertNotification, ref offset); alertNotification.SourceAddrTon = buf.ExtractByte(ref offset); alertNotification.SourceAddrNpi = buf.ExtractByte(ref offset); alertNotification.SourceAddr = buf.ExtractCString(ref offset); alertNotification.EsmeAddrTon = buf.ExtractByte(ref offset); alertNotification.EsmeAddrNpi = buf.ExtractByte(ref offset); alertNotification.EsmeAddr = buf.ExtractCString(ref offset); while (offset - start_offset < alertNotification.Length) { alertNotification.Optional.Add(buf.ExtractTLV(ref offset)); } } catch { alertNotification = null; } return(alertNotification); }
/// <summary> Called to create a CancelSm object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> CancelSm </returns> internal static CancelSm Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { var cancelSm = new CancelSm(defaultEncoding); try { buf.ExtractHeader(cancelSm, ref offset); cancelSm.ServiceType = buf.ExtractCString(ref offset); cancelSm.MessageId = buf.ExtractCString(ref offset); cancelSm.SourceTon = buf.ExtractByte(ref offset); cancelSm.SourceNpi = buf.ExtractByte(ref offset); cancelSm.SourceAddr = buf.ExtractCString(ref offset); cancelSm.DestTon = buf.ExtractByte(ref offset); cancelSm.DestNpi = buf.ExtractByte(ref offset); cancelSm.DestAddr = buf.ExtractCString(ref offset); } catch { cancelSm = null; } return(cancelSm); }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> private SubmitMultiSm(DataCodings defaultEncoding) : base(defaultEncoding, CommandSet.SubmitMultiSm, SequenceGenerator.Counter) { DestinationAddresses = new List <DestinationAddress>(); Optional = new TLVCollection(); UserData = UserData.Create(); }
/// <summary> Called to create a PduBind object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> BindSm </returns> public static BindSm Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { BindSm bindSm = new BindSm(defaultEncoding); try { int start_offset = offset; buf.ExtractHeader(bindSm, ref offset); bindSm.SystemId = buf.ExtractCString(ref offset); bindSm.Password = buf.ExtractCString(ref offset); bindSm.SystemType = buf.ExtractCString(ref offset); bindSm.InterfaceVersion = buf.ExtractByte(ref offset); bindSm.AddrTon = buf.ExtractByte(ref offset); bindSm.AddrNpi = buf.ExtractByte(ref offset); bindSm.AddressRange = buf.ExtractCString(ref offset); } catch { bindSm = null; } return bindSm; }
/// <summary> Called to create a AlertNotification object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> AlertNotification </returns> public static AlertNotification Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { AlertNotification alertNotification = new AlertNotification(defaultEncoding); try { int start_offset = offset; buf.ExtractHeader(alertNotification, ref offset); alertNotification.SourceAddrTon = buf.ExtractByte(ref offset); alertNotification.SourceAddrNpi = buf.ExtractByte(ref offset); alertNotification.SourceAddr = buf.ExtractCString(ref offset); alertNotification.EsmeAddrTon = buf.ExtractByte(ref offset); alertNotification.EsmeAddrNpi = buf.ExtractByte(ref offset); alertNotification.EsmeAddr = buf.ExtractCString(ref offset); while (offset - start_offset < alertNotification.Length) { alertNotification.Optional.Add(buf.ExtractTLV(ref offset)); } } catch { alertNotification = null; } return alertNotification; }
/// <summary> Called to add a transmitter connection </summary> /// <param name="connectionId"></param> /// <param name="host"></param> /// <param name="port"></param> /// <param name="userName"></param> /// <param name="password"></param> /// <param name="logKey"></param> /// <param name="defaultEncoding"></param> private void AddTransmitterConnection(int connectionId, string host, int port, string userName, string password, string logKey, DataCodings defaultEncoding) { lock (Transmitters) { // Create the smppConnection object var smppConnection = new EsmeConnection(connectionId, ShortLongCode, ConnectionModes.Transmitter, host, port, userName, password, logKey, defaultEncoding, ConnectionEventConnectionHandler, null, ReceivedGenericNackConnectionHandler, SubmitMessageConnectionHandler, QueryMessageConnectionHandler, LogEventConnectionHandler, PduDetailsConnectionHandler); // Add the connection to the list Transmitters.Add(connectionId, smppConnection); } }
/// <summary> Called to create a PduBindResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> PduBindResp </returns> public static BindSmResp Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { var bindResp = new BindSmResp(defaultEncoding); try { var start_offset = offset; buf.ExtractHeader(bindResp, ref offset); bindResp.SystemId = buf.ExtractCString(ref offset); while (offset - start_offset < bindResp.Length) { bindResp.Optional.Add(buf.ExtractTLV(ref offset)); } } catch { bindResp = null; } return(bindResp); }
/// <summary> Called to create a SubmitMultiResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> SubmitMultiResp </returns> public static SubmitMultiSmResp Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { SubmitMultiSmResp submitMultiResp = new SubmitMultiSmResp(defaultEncoding); try { int start_offset = offset; buf.ExtractHeader(submitMultiResp, ref offset); if (submitMultiResp.Length > Header.HEADER_LENGTH) { submitMultiResp.MessageId = buf.ExtractCString(ref offset); submitMultiResp.UnsuccessDestinationAddresses = buf.ExtractUnsuccessDestinationAddresses(ref offset); while (offset - start_offset < submitMultiResp.Length) { submitMultiResp.Optional.Add(buf.ExtractTLV(ref offset)); } } } catch { submitMultiResp = null; } return(submitMultiResp); }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="commandStatus"></param> /// <param name="sequence"></param> /// <param name="messageId"></param> private SubmitMultiSmResp(DataCodings defaultEncoding, CommandStatus commandStatus, uint sequence, string messageId) : base(defaultEncoding, CommandSet.SubmitMultiSmResp, commandStatus, sequence) { MessageId = messageId; UnsuccessDestinationAddresses = new List<UnsuccessDestinationAddress>(); Optional = new TLVCollection(); }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> private DeliverSm(DataCodings defaultEncoding) : base(defaultEncoding, CommandSet.DeliverSm, SequenceGenerator.Counter) { Optional = new TLVCollection(); ValidityPeriod = DateTime.Now.AddDays(2).ToString("yyMMddhhmmss000+"); UserData = UserData.Create(); }
/// <summary> Called to create a EnquireLinkResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="enquireLink"></param> /// <param name="commandStatus"></param> /// <returns> EnquireLinkResp </returns> public static EnquireLinkSmResp Create(DataCodings defaultEncoding, EnquireLinkSm enquireLink, CommandStatus commandStatus) { return(new EnquireLinkSmResp(defaultEncoding, commandStatus, enquireLink.Sequence)); }
/// <summary> Called to create a EnquireLinkResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="status"></param> /// <param name="sequence"></param> /// <returns> EnquireLinkResp </returns> public static EnquireLinkSmResp Create(DataCodings defaultEncoding, CommandStatus status, uint sequence) { return(new EnquireLinkSmResp(defaultEncoding, status, sequence)); }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="commandStatus"></param> /// <param name="sequence"></param> private EnquireLinkSmResp(DataCodings defaultEncoding, CommandStatus commandStatus, uint sequence) : base(defaultEncoding, CommandSet.EnquireLinkResp, commandStatus, sequence) { }
/// <summary> Called to create a GenericNack object </summary> /// <param name="defaultEncoding"></param> /// <param name="status"></param> /// <param name="sequence"></param> /// <returns> GenericNack </returns> public static GenericNackSm Create(DataCodings defaultEncoding, CommandStatus status, uint sequence) { return(new GenericNackSm(defaultEncoding, status, sequence)); }
/// <summary> Called to create a PduUnBindResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="unBindSm"></param> /// <param name="commandStatus"></param> /// <returns> PduUnBindResp </returns> internal static UnBindSmResp Create(DataCodings defaultEncoding, UnBindSm unBindSm, CommandStatus commandStatus) { return(new UnBindSmResp(defaultEncoding, commandStatus, unBindSm.Sequence)); }
/// <summary> Called to create a SubmitMultiResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="commandStatus"></param> /// <param name="sequence"></param> /// <returns> UnBindSmResp </returns> public static UnBindSmResp Create(DataCodings defaultEncoding, CommandStatus commandStatus, uint sequence) { return(new UnBindSmResp(defaultEncoding, commandStatus, sequence)); }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="commandStatus"></param> /// <param name="sequence"></param> private UnBindSmResp(DataCodings defaultEncoding, CommandStatus commandStatus, uint sequence) : base(defaultEncoding, CommandSet.UnbindResp, commandStatus, sequence) { }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="commandStatus"></param> /// <param name="sequence"></param> private CancelSmResp(DataCodings defaultEncoding, CommandStatus commandStatus, uint sequence) : base(defaultEncoding, CommandSet.CancelSmResp, commandStatus, sequence) { }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> private SubmitMultiSm(DataCodings defaultEncoding) : base(defaultEncoding, CommandSet.SubmitMultiSm, SequenceGenerator.Counter) { DestinationAddresses = new List<DestinationAddress>(); Optional = new TLVCollection(); UserData = UserData.Create(); }
/// <summary> Called to create a CancelSmResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="cancelSm"></param> /// <param name="status"></param> /// <returns> CancelSmResp </returns> public static CancelSmResp Create(DataCodings defaultEncoding, CancelSm cancelSm, CommandStatus status) { return(new CancelSmResp(defaultEncoding, status, cancelSm.Sequence)); }
/// <summary> Called to create a SubmitSmResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="status"></param> /// <param name="sequence"></param> /// <returns> SubmitSmResp </returns> public static SubmitSmResp Create(DataCodings defaultEncoding, CommandStatus status, uint sequence) { return(new SubmitSmResp(defaultEncoding, status, sequence)); }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="status"></param> /// <param name="sequence"></param> private GenericNackSm(DataCodings defaultEncoding, CommandStatus status, uint sequence) : base(defaultEncoding) { Length = (uint) Header.HEADER_LENGTH; Command = CommandSet.GenericNack; Status = status; Sequence = sequence; }
/// <summary> Called to covnert the short message into a string </summary> /// <param name="defaultEncoding"></param> /// <param name="dataCoding"></param> /// <returns> string </returns> public string ShortMessageText(DataCodings defaultEncoding, DataCodings dataCoding) { var smppBuff = new SmppBuffer(defaultEncoding, ShortMessage); return(smppBuff.ExtractEncodedString(dataCoding)); }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="commandStatus"></param> /// <param name="sequence"></param> private SubmitSmResp(DataCodings defaultEncoding, CommandStatus commandStatus, uint sequence) : base(defaultEncoding, CommandSet.SubmitSmResp, commandStatus, sequence) { Optional = new TLVCollection(); }
/// <summary> Called to create a DeliverSmResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="deliverSm"></param> /// <param name="commandStatus"></param> /// <returns> DeliverSmResp </returns> public static DeliverSmResp Create(DataCodings defaultEncoding, DeliverSm deliverSm, CommandStatus commandStatus) { if (deliverSm.SourceAddr == string.Empty || deliverSm.SourceAddr == null) { commandStatus = CommandStatus.ESME_RINVSRCADR; } return(new DeliverSmResp(defaultEncoding, commandStatus, deliverSm.Sequence)); }
/// <summary> Called to create a DataSmResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="dataSm"></param> /// <param name="commandStatus"></param> /// <param name="messageId"></param> /// <returns> DataSmResp </returns> public static DataSmResp Create(DataCodings defaultEncoding, DataSm dataSm, CommandStatus commandStatus, string messageId) { if (dataSm.SourceAddr == string.Empty || dataSm.SourceAddr == null) { commandStatus = CommandStatus.ESME_RINVSRCADR; } return new DataSmResp(defaultEncoding, commandStatus, dataSm.Sequence, messageId); }
/// <summary> Called to create a DataSmResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="submitSm"></param> /// <param name="commandStatus"></param> /// <param name="messageId"></param> /// <returns> DataSmResp </returns> public static SubmitSmResp Create(DataCodings defaultEncoding, SubmitSm submitSm, CommandStatus commandStatus, string messageId) { if (submitSm.DestAddr == string.Empty || submitSm.DestAddr == null) { commandStatus = CommandStatus.ESME_RINVDSTADR; } return(new SubmitSmResp(defaultEncoding, commandStatus, submitSm.Sequence, messageId)); }
/// <summary> Called to create a DataSmResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="submitSm"></param> /// <param name="commandStatus"></param> /// <param name="messageId"></param> /// <returns> DataSmResp </returns> public static SubmitSmResp Create(DataCodings defaultEncoding, SubmitSm submitSm, CommandStatus commandStatus, string messageId) { if (submitSm.DestAddr == string.Empty || submitSm.DestAddr == null) { commandStatus = CommandStatus.ESME_RINVDSTADR; } return new SubmitSmResp(defaultEncoding, commandStatus, submitSm.Sequence, messageId); }
/// <summary> Called to create a DeliverSmResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="deliverSm"></param> /// <param name="commandStatus"></param> /// <returns> DeliverSmResp </returns> public static DeliverSmResp Create(DataCodings defaultEncoding, DeliverSm deliverSm, CommandStatus commandStatus) { if (deliverSm.SourceAddr == string.Empty || deliverSm.SourceAddr == null) { commandStatus = CommandStatus.ESME_RINVSRCADR; } return new DeliverSmResp(defaultEncoding, commandStatus, deliverSm.Sequence); }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="bytes"></param> /// <param name="length"></param> public SmppBuffer(DataCodings defaultEncoding, byte[] bytes, int length) { DefaultEncoding = defaultEncoding; byte[] b = new byte[length]; Array.Copy(bytes, b, length); ListBuffer = new List<byte>(); ListBuffer.AddRange(b); }
/// <summary> Constructor /// BindSmResp requires this because we don't know the command set until later </summary> /// <param name="defaultEncoding"></param> public Header(DataCodings defaultEncoding) { DefaultEncoding = defaultEncoding; PduData = null; ExternalId = null; Length = HEADER_LENGTH; Status = CommandStatus.ESME_ROK; Sequence = 0; }
/// <summary> Constructor </summary> /// <param name="commandSet"></param> /// <param name="sequence"></param> /// <param name="defaultEncoding"></param> public Header(DataCodings defaultEncoding, CommandSet commandSet, uint sequence) { DefaultEncoding = defaultEncoding; PduData = null; Length = HEADER_LENGTH; Command = commandSet; Status = CommandStatus.ESME_ROK; Sequence = sequence; }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="serviceType"></param> /// <param name="sourceTon"></param> /// <param name="sourceNpi"></param> /// <param name="sourceAddr"></param> /// <param name="destinationAddresses"></param> private SubmitMultiSm(DataCodings defaultEncoding, string serviceType, byte sourceTon, byte sourceNpi, string sourceAddr, List<DestinationAddress> destinationAddresses) : base(defaultEncoding, CommandSet.SubmitMultiSm, SequenceGenerator.Counter) { Optional = new TLVCollection(); UserData = UserData.Create(); ServiceType = serviceType; SourceTon = sourceTon; SourceNpi = sourceNpi; SourceAddr = sourceAddr; DestinationAddresses = destinationAddresses; }
/// <summary> Constructor </summary> /// <param name="commandSet"></param> /// <param name="commandStatus"></param> /// <param name="defaultEncoding"></param> public Header(DataCodings defaultEncoding, CommandSet commandSet, CommandStatus commandStatus) { DefaultEncoding = defaultEncoding; PduData = null; ExternalId = null; Length = HEADER_LENGTH; Command = commandSet; Status = commandStatus; Sequence = 0; }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="serviceType"></param> /// <param name="messageId"></param> /// <param name="srcTon"></param> /// <param name="srcNpi"></param> /// <param name="srcAddr"></param> /// <param name="dstTon"></param> /// <param name="dstNpi"></param> /// <param name="dstAddr"></param> private CancelSm(DataCodings defaultEncoding, string serviceType, string messageId, byte srcTon, byte srcNpi, string srcAddr, byte dstTon, byte dstNpi, string dstAddr) : this(defaultEncoding) { ServiceType = serviceType; MessageId = messageId; SourceTon = srcTon; SourceNpi = srcNpi; SourceAddr = srcAddr; DestTon = dstTon; DestNpi = dstNpi; DestAddr = dstAddr; }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="header"></param> public SmppBuffer(DataCodings defaultEncoding, Header header) { DefaultEncoding = defaultEncoding; ListBuffer = new List<byte>(); AddUInt((uint) header.Command); AddUInt((uint) header.Status); AddUInt((uint) header.Sequence); // Use AddFinalLength to add the length to the // beginning of the buffer }
/// <summary> Called to create a PduUnBind object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> PduUnBind </returns> public static UnBindSm Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { UnBindSm unBind = new UnBindSm(defaultEncoding); try { buf.ExtractHeader(unBind, ref offset); } catch { unBind = null; } return unBind; }
/// <summary> Constructor</summary> /// <param name="defaultEncoding"></param> /// <param name="serviceType"></param> /// <param name="sourceTon"></param> /// <param name="sourceNpi"></param> /// <param name="sourceAddr"></param> /// <param name="destTon"></param> /// <param name="destNpi"></param> /// <param name="destAddr"></param> private DeliverSm(DataCodings defaultEncoding, string serviceType, byte sourceTon, byte sourceNpi, string sourceAddr, byte destTon, byte destNpi, string destAddr) : base(defaultEncoding, CommandSet.DeliverSm, SequenceGenerator.Counter) { Optional = new TLVCollection(); ValidityPeriod = DateTime.Now.AddDays(2).ToString("yyMMddhhmmss000+"); UserData = UserData.Create(); ServiceType = serviceType; SourceTon = sourceTon; SourceNpi = sourceNpi; SourceAddr = sourceAddr; DestTon = destTon; DestNpi = destNpi; DestAddr = destAddr; }
/// <summary> Called to create a new EnquireLink object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> EnquireLink </returns> public static EnquireLinkSm Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { EnquireLinkSm enquireLink = new EnquireLinkSm(defaultEncoding); try { buf.ExtractHeader(enquireLink, ref offset); } catch { enquireLink = null; } return enquireLink; }
/// <summary> Called to create a GenericNack object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> GenericNack </returns> public static GenericNackSm Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { GenericNackSm genericNack = new GenericNackSm(defaultEncoding); try { buf.ExtractHeader(genericNack, ref offset); } catch { genericNack = null; } return genericNack; }
/// <summary> Called to create a QuerySm object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> QuerySm </returns> public static QuerySm Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { QuerySm querySm = new QuerySm(defaultEncoding); try { buf.ExtractHeader(querySm, ref offset); querySm.MessageId = buf.ExtractCString(ref offset); querySm.SourceTon = buf.ExtractByte(ref offset); querySm.SourceNpi = buf.ExtractByte(ref offset); querySm.SourceAddr = buf.ExtractCString(ref offset); } catch { querySm = null; } return querySm; }
/// <summary> Called to create a CancelSm object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> CancelSm </returns> internal static CancelSm Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { CancelSm cancelSm = new CancelSm(defaultEncoding); try { buf.ExtractHeader(cancelSm, ref offset); cancelSm.ServiceType = buf.ExtractCString(ref offset); cancelSm.MessageId = buf.ExtractCString(ref offset); cancelSm.SourceTon = buf.ExtractByte(ref offset); cancelSm.SourceNpi = buf.ExtractByte(ref offset); cancelSm.SourceAddr = buf.ExtractCString(ref offset); cancelSm.DestTon = buf.ExtractByte(ref offset); cancelSm.DestNpi = buf.ExtractByte(ref offset); cancelSm.DestAddr = buf.ExtractCString(ref offset); } catch { cancelSm = null; } return cancelSm; }
/// <summary> Called to create a CancelSm object </summary> /// <param name="defaultEncoding"></param> /// <param name="serviceType"></param> /// <param name="messageId"></param> /// <param name="srcTon"></param> /// <param name="srcNpi"></param> /// <param name="srcAddr"></param> /// <param name="dstTon"></param> /// <param name="dstNpi"></param> /// <param name="dstAddr"></param> /// <returns> CancelSm </returns> internal static CancelSm Create(DataCodings defaultEncoding, string serviceType, string messageId, byte srcTon, byte srcNpi, string srcAddr, byte dstTon, byte dstNpi, string dstAddr) { return new CancelSm(defaultEncoding, serviceType, messageId, srcTon, srcNpi, srcAddr, dstTon, dstNpi, dstAddr); }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> private CancelSm(DataCodings defaultEncoding) : base(defaultEncoding, CommandSet.CancelSm, SequenceGenerator.Counter) { }
/// <summary> Parses the smpp buffer to a DeliverSm object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> DeliverSm </returns> public static DeliverSm Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { DeliverSm deliverSm = new DeliverSm(defaultEncoding); try { int start_offset = offset; buf.ExtractHeader(deliverSm, ref offset); deliverSm.ServiceType = buf.ExtractCString(ref offset); deliverSm.SourceTon = buf.ExtractByte(ref offset); deliverSm.SourceNpi = buf.ExtractByte(ref offset); deliverSm.SourceAddr = buf.ExtractCString(ref offset); deliverSm.DestTon = buf.ExtractByte(ref offset); deliverSm.DestNpi = buf.ExtractByte(ref offset); deliverSm.DestAddr = buf.ExtractCString(ref offset); deliverSm.EsmClass = buf.ExtractByte(ref offset); deliverSm.ProtocolId = buf.ExtractByte(ref offset); deliverSm.PriorityFlag = buf.ExtractByte(ref offset); deliverSm.ScheduleDeliveryTime = buf.ExtractCString(ref offset); deliverSm.ValidityPeriod = buf.ExtractCString(ref offset); deliverSm.RegisteredDelivery = buf.ExtractByte(ref offset); deliverSm.ReplaceIfPresent = buf.ExtractByte(ref offset); deliverSm.DataCoding = (DataCodings) buf.ExtractByte(ref offset); deliverSm.DefaultMessageId = buf.ExtractByte(ref offset); deliverSm.ShortMessageLength = buf.ExtractByte(ref offset); if (deliverSm.ShortMessageLength > 0) { deliverSm.UserDataBuffer = new SmppBuffer(defaultEncoding, buf.ExtractByteArray(ref offset, deliverSm.ShortMessageLength)); } while (offset - start_offset < deliverSm.Length) { deliverSm.Optional.Add(buf.ExtractTLV(ref offset)); } if (deliverSm.ShortMessageLength == 0) { if (deliverSm.Optional != null && deliverSm.Optional.Count > 0) { TLV tlv_payload = deliverSm.Optional[OptionalTags.MessagePayload]; if (tlv_payload != null) { deliverSm.UserDataBuffer = new SmppBuffer(defaultEncoding, tlv_payload.Value); } TLV tlv_globalSeq = deliverSm.Optional[OptionalTags.SarMsgRefNum]; if (tlv_globalSeq != null) { deliverSm.MessageReferenceNumber = SmppBuffer.BytesToShort(tlv_globalSeq.Value, 0); } TLV tlv_pocketsNumber = deliverSm.Optional[OptionalTags.SarTotalSegments]; if (tlv_pocketsNumber != null) { deliverSm.TotalSegments = tlv_pocketsNumber.Value[0]; } TLV tlv_localSeq = deliverSm.Optional[OptionalTags.SarSegmentSeqnum]; if (tlv_localSeq != null) { deliverSm.SeqmentNumber = tlv_localSeq.Value[0]; } } } if (deliverSm.UserDataBuffer != null && deliverSm.UserDataBuffer.Length > 0) { bool hasUDHI = deliverSm.MessageFeature == GSMSpecificFeatures.UDHI || deliverSm.MessageFeature == GSMSpecificFeatures.UDHIandReplyPath; deliverSm.UserData = UserData.Create(deliverSm.UserDataBuffer, hasUDHI); if (deliverSm.UserData.Headers.Count > 0) { UserDataHeader udh = deliverSm.UserData.Headers[InformationElementIdentifiers.ConcatenatedShortMessages8bit]; if (udh != null) { deliverSm.MessageReferenceNumber = udh.Data[0]; deliverSm.TotalSegments = udh.Data[1]; deliverSm.SeqmentNumber = udh.Data[2]; } udh = deliverSm.UserData.Headers[InformationElementIdentifiers.ConcatenatedShortMessage16bit]; if (udh != null) { deliverSm.MessageReferenceNumber = SmppBuffer.BytesToShort(udh.Data, 0); deliverSm.TotalSegments = udh.Data[2]; deliverSm.SeqmentNumber = udh.Data[3]; } } } else { deliverSm.UserData = UserData.Create(); } } catch { deliverSm = null; } return deliverSm; }
/// <summary> Called to create a DeliverSm object </summary> /// <param name="defaultEncoding"></param> /// <param name="serviceType"></param> /// <param name="sourceTon"></param> /// <param name="sourceNpi"></param> /// <param name="sourceAddr"></param> /// <param name="destTon"></param> /// <param name="destNpi"></param> /// <param name="destAddr"></param> /// <returns> SubmitSm </returns> public static DeliverSm Create(DataCodings defaultEncoding, string serviceType, byte sourceTon, byte sourceNpi, string sourceAddr, byte destTon, byte destNpi, string destAddr) { return new DeliverSm(defaultEncoding, serviceType, sourceTon, sourceNpi, sourceAddr, destTon, destNpi, destAddr); }
/// <summary> Called to create a DeliverSm object </summary> /// <param name="defaultEncoding"></param> /// <returns> DeliverSm </returns> public static DeliverSm Create(DataCodings defaultEncoding) { return new DeliverSm(defaultEncoding); }
/// <summary> Constructor </summary> /// <param name="defaultEncoding"></param> /// <param name="header"></param> public Header(DataCodings defaultEncoding, Header header) { DefaultEncoding = defaultEncoding; PduData = null; Length = header.Length; Command = header.Command; Status = header.Status; Sequence = header.Sequence; }