Пример #1
0
 public SmppDeliverSmReq(ByteBuilder bb) {
   _Header = new SmppHeader(bb);
   int startPosition = 0x10;
   _Body = new BodyPdu(bb, ref startPosition);
   if (bb.Count > startPosition)
     _Tlv = new SmppTlv(bb, startPosition);
 }
Пример #2
0
 internal BodyPdu(ByteBuilder bb, ref int StartPosition) {
   _ServiceType = SmppServiceType.Default;
   _SourceAddress = string.Empty;
   _DestinationAddress = string.Empty;
   _EsmClass = new BitBuilder();
   _RegisteredDelivery = new BitBuilder();
   _ShortMessage = new SmppString();
   _ServiceType =
     SmppServiceType.FromValue(
       SmppDataCoding.BaseEncoding.GetString(bb.ReadBytesUntil(ref StartPosition, 0)));
   _SourceAddressTon = bb.ReadByte(ref StartPosition);
   _SourceAddressNpi = bb.ReadByte(ref StartPosition);
   _SourceAddress = SmppDataCoding.BaseEncoding.GetString(bb.ReadBytesUntil(ref StartPosition, 0));
   _DestinationAddressTon = bb.ReadByte(ref StartPosition);
   _DestinationAddressNpi = bb.ReadByte(ref StartPosition);
   _DestinationAddress = SmppDataCoding.BaseEncoding.GetString(bb.ReadBytesUntil(ref StartPosition, 0));
   _EsmClass.Value = bb.ReadByte(ref StartPosition);
   _ProtocolId = bb.ReadByte(ref StartPosition);
   _PriorityFlag = bb.ReadByte(ref StartPosition);
   _ScheduleDeliveryTime =
     new SmppDateTime(SmppDataCoding.BaseEncoding.GetString(bb.ReadBytesUntil(ref StartPosition, 0)));
   _ValidityPeriod =
     new SmppDateTime(SmppDataCoding.BaseEncoding.GetString(bb.ReadBytesUntil(ref StartPosition, 0)));
   _RegisteredDelivery.Value = bb.ReadByte(ref StartPosition);
   _ReplaceIfPresent = bb.ReadByte(ref StartPosition);
   _ShortMessage.DataCoding = SmppDataCoding.FromValue(bb.ReadByte(ref StartPosition));
   _SmDefaultMessageId = bb.ReadByte(ref StartPosition);
   byte length = bb.ReadByte(ref StartPosition);
   _ShortMessage.Value = bb.ReadBytes(ref StartPosition, length);
 }
Пример #3
0
 public byte[] ToByteArray() {
   var builder = new ByteBuilder(0x10);
   builder.AddRange(SmppConverter.FromInt32ToByteArray(_CommandLength));
   builder.AddRange(SmppConverter.FromInt32ToByteArray(_CommandId));
   builder.AddRange(SmppConverter.FromInt32ToByteArray(_CommandStatus));
   builder.AddRange(SmppConverter.FromInt32ToByteArray(_SequenceNumber));
   return builder.ToArray();
 }
Пример #4
0
 internal BodyPdu(ByteBuilder bb, ref int StartPosition) {
   _MessageId = string.Empty;
   _SourceAddress = string.Empty;
   _MessageId = SmppDataCoding.BaseEncoding.GetString(bb.ReadBytesUntil(ref StartPosition, 0));
   _SourceAddressTon = bb.ReadByte(ref StartPosition);
   _SourceAddressNpi = bb.ReadByte(ref StartPosition);
   _SourceAddress = SmppDataCoding.BaseEncoding.GetString(bb.ReadBytesUntil(ref StartPosition, 0));
 }
Пример #5
0
 public byte[] ToByteArray() {
   var builder = new ByteBuilder(300);
   builder.AddRange(_Header.ToByteArray());
   builder.AddRange(_Body.ToByteArray());
   if (_Tlv != null)
     builder.AddRange(_Tlv.ToByteArray());
   return builder.ToArray();
 }
Пример #6
0
 internal SmppBindRes(ByteBuilder bb) {
   int startPosition = 0x10;
   _Header = new SmppHeader(bb);
   if (bb.Count > 0x10)
     _Body = new BodyPdu(bb, ref startPosition);
   if (bb.Count > startPosition)
     _Tlv = new SmppTlv(bb, startPosition);
 }
Пример #7
0
 internal BodyPdu(ByteBuilder bb, ref int LastBytePosition) {
   _MessageId = string.Empty;
   _MessageId = SmppDataCoding.BaseEncoding.GetString(bb.ReadBytesUntil(ref LastBytePosition, 0));
   _FinalDate =
     new SmppDateTime(SmppDataCoding.BaseEncoding.GetString(bb.ReadBytesUntil(ref LastBytePosition, 0)));
   _MessageState = bb.ReadByte(ref LastBytePosition);
   _ErrorCode = bb.ReadByte(ref LastBytePosition);
   LastBytePosition--;
 }
Пример #8
0
 public byte[] ToByteArray() {
   var builder = new ByteBuilder(300);
   byte[] c = _Body.ToByteArray();
   _Header.CommandLength = 0x10 + c.Length;
   byte[] buffer2 = _Header.ToByteArray();
   builder.AddRange(buffer2);
   builder.AddRange(c);
   return builder.ToArray();
 }
Пример #9
0
 internal SmppSubmitSmRes(ByteBuilder bb) {
   if (bb.Count >= 0x10) {
     _Header = new SmppHeader(bb);
     if (bb.Count != 0x10) {
       int lastBytePosition = 0x10;
       _Body = new BodyPdu(bb, ref lastBytePosition);
       if (bb.Count >= lastBytePosition)
         _Tlv = new SmppTlv(bb, lastBytePosition);
     }
   }
 }
Пример #10
0
 internal BodyPdu(ByteBuilder PduByteArray, ref int StartPosition) {
   _SystemId = string.Empty;
   _Password = string.Empty;
   _SystemType = string.Empty;
   _AddressRange = string.Empty;
   _SystemId = SmppDataCoding.BaseEncoding.GetString(PduByteArray.ReadBytesUntil(ref StartPosition, 0));
   _Password = SmppDataCoding.BaseEncoding.GetString(PduByteArray.ReadBytesUntil(ref StartPosition, 0));
   _SystemType = SmppDataCoding.BaseEncoding.GetString(PduByteArray.ReadBytesUntil(ref StartPosition, 0));
   _InterfaceVersion = PduByteArray.ReadByte(ref StartPosition);
   _AddressTon = PduByteArray.ReadByte(ref StartPosition);
   _AddressNpi = PduByteArray.ReadByte(ref StartPosition);
   _AddressRange = SmppDataCoding.BaseEncoding.GetString(PduByteArray.ReadBytesUntil(ref StartPosition, 0));
 }
Пример #11
0
 public byte[] ToByteArray() {
   byte[] c = null;
   byte[] buffer2 = _Body.ToByteArray();
   byte[] buffer3 = null;
   _Header.CommandLength = 0x10 + buffer2.Length;
   if (_Tlv != null) {
     buffer3 = _Tlv.ToByteArray();
     _Header.CommandLength += buffer3.Length;
   }
   c = _Header.ToByteArray();
   var builder = new ByteBuilder(c.Length + buffer2.Length);
   builder.AddRange(c);
   builder.AddRange(buffer2);
   builder.AddRange(buffer3);
   return builder.ToArray();
 }
Пример #12
0
 public byte[] ToByteArray() {
   byte[] c = null;
   byte[] buffer2 = _Body.ToByteArray();
   byte[] arrayObj = null;
   _Header.CommandLength = 0x10 + buffer2.Length;
   if (_Tlv != null) {
     arrayObj = _Tlv.ToByteArray();
     _Header.CommandLength += arrayObj.Length;
   }
   c = _Header.ToByteArray();
   var builder = new ByteBuilder((c.Length + buffer2.Length) + SmppConverter.GetArrayLength(arrayObj));
   builder.AddRange(c);
   builder.AddRange(buffer2);
   if (arrayObj != null)
     builder.AddRange(arrayObj);
   return builder.ToArray();
 }
Пример #13
0
 internal static byte[] GetPduByteArray(ref SmppHeader Header, ISmppBasic Body, SmppTlv Tlv) {
   byte[] c = null;
   byte[] buffer2 = null;
   byte[] arrayObj = null;
   buffer2 = Body.ToByteArray();
   Header.CommandLength = 0x10 + buffer2.Length;
   if (Tlv != null) {
     arrayObj = Tlv.ToByteArray();
     Header.CommandLength += arrayObj.Length;
   }
   c = Header.ToByteArray();
   var builder = new ByteBuilder((c.Length + buffer2.Length) + GetArrayLength(arrayObj));
   builder.AddRange(c);
   builder.AddRange(buffer2);
   if (arrayObj != null)
     builder.AddRange(arrayObj);
   return builder.ToArray();
 }
Пример #14
0
 public byte[] ToByteArray() {
   var builder = new ByteBuilder(30);
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_MessageId)));
   builder.Add(_SourceAddressTon);
   builder.Add(_SourceAddressNpi);
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_SourceAddress)));
   return builder.ToArray();
 }
Пример #15
0
 public byte[] ToByteArray() {
   var builder = new ByteBuilder(30);
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_MessageId)));
   if (_FinalDate == null)
     builder.AddRange(SmppConverter.SmppNullEnd(null));
   else
     builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_FinalDate.SmppDate)));
   builder.Add(_MessageState);
   builder.Add(_ErrorCode);
   return builder.ToArray();
 }
Пример #16
0
 internal SmppHeader(ByteBuilder bb) {
   _CommandLength = SmppConverter.FromByteArrayToInt32(bb.ToArray(0, 4));
   _CommandId = SmppConverter.FromByteArrayToInt32(bb.ToArray(4, 4));
   _CommandStatus = SmppConverter.FromByteArrayToInt32(bb.ToArray(8, 4));
   _SequenceNumber = SmppConverter.FromByteArrayToInt32(bb.ToArray(12, 4));
 }
Пример #17
0
 internal SmppQuerySmRes(ByteBuilder bb) {
   _Header = new SmppHeader(bb);
   int lastBytePosition = 0x10;
   _Body = new BodyPdu(bb, ref lastBytePosition);
 }
Пример #18
0
 public SmppTlv(byte[] Data) {
   Items = new ArrayList(10);
   if (Data != null) {
     short num3;
     var builder = new ByteBuilder(Data);
     for (int i = 0; i < builder.Count; i += 4 + num3) {
       short tagId = SmppConverter.FromByteArrayToInt16(builder.ToArray(i, 2));
       num3 = SmppConverter.FromByteArrayToInt16(builder.ToArray(i + 2, 2));
       byte[] buffer = builder.ToArray(i + 4, num3);
       var tag = new Tag(tagId);
       tag.SetByteArray(buffer);
       Items.Add(tag);
     }
   }
 }
Пример #19
0
 internal SmppDeliverSmRes(ByteBuilder bb) {
   int startPosition = 0x10;
   _Header = new SmppHeader(bb);
   _Body = new BodyPdu(bb, ref startPosition);
   _Tlv = new SmppTlv(bb, startPosition);
 }
Пример #20
0
 public byte[] ToByteArray() {
   var builder = new ByteBuilder(200);
   builder.AddRange(Header.ToByteArray());
   builder.AddRange(Body.ToByteArray());
   return builder.ToArray();
 }
Пример #21
0
 internal SmppCancelSmRes(ByteBuilder bb) {
   _Header = new SmppHeader(bb);
 }
Пример #22
0
 internal BodyPdu(ByteBuilder PduByteArray, ref int StartPosition) {
   _SystemId = string.Empty;
   _SystemId = SmppDataCoding.BaseEncoding.GetString(PduByteArray.ReadBytesUntil(ref StartPosition, 0));
 }
Пример #23
0
 internal SmppEnquireLinkReq(ByteBuilder bb) {
   _Header = new SmppHeader(bb);
 }
Пример #24
0
 internal SmppTlv(ByteBuilder bb, int StartPosition) : this(bb.ToArray(StartPosition, bb.Count - StartPosition)) {}
Пример #25
0
 internal SmppUnBindReq(ByteBuilder bb) {
   _Header = new SmppHeader(bb);
 }
Пример #26
0
 internal SmppBindReq(ByteBuilder bb) {
   int startPosition = 0x10;
   _Header = new SmppHeader(bb);
   _Body = new BodyPdu(bb, ref startPosition);
 }
Пример #27
0
 public byte[] ToByteArray() {
   var builder = new ByteBuilder(90);
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_SystemId)));
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_Password)));
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_SystemType)));
   builder.Add(_InterfaceVersion);
   builder.Add(_AddressTon);
   builder.Add(_AddressNpi);
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_AddressRange)));
   return builder.ToArray();
 }
Пример #28
0
 public byte[] ToByteArray() {
   var builder = new ByteBuilder(100);
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(MessageId)));
   return builder.ToArray();
 }
Пример #29
0
 internal SessionObject(int inSocketBufferSize, int inServerBufferSize) {
   Buffer = new byte[inSocketBufferSize];
   dataIn = new ByteBuilder(inServerBufferSize);
 }
Пример #30
0
 public byte[] ToByteArray() {
   var builder = new ByteBuilder(100);
   if (Items != null)
     foreach (Tag tag in Items) {
       builder.AddRange(SmppConverter.FromInt16ToByteArray(tag.TagId));
       builder.AddRange(SmppConverter.FromInt16ToByteArray(tag.Length));
       builder.AddRange(tag.GetByteArray());
     }
   return builder.ToArray();
 }