Exemple #1
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();
 }
Exemple #2
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();
 }
Exemple #3
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();
 }
Exemple #4
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();
 }
Exemple #5
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();
 }
Exemple #6
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();
 }
Exemple #7
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();
 }
Exemple #8
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();
 }
Exemple #9
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();
 }
Exemple #10
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();
 }
Exemple #11
0
 public byte[] ToByteArray() {
   var builder = new ByteBuilder(100);
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(MessageId)));
   return builder.ToArray();
 }
Exemple #12
0
 public byte[] ToByteArray() {
   var builder = new ByteBuilder(200);
   builder.AddRange(Header.ToByteArray());
   builder.AddRange(Body.ToByteArray());
   return builder.ToArray();
 }
Exemple #13
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);
     }
   }
 }
Exemple #14
0
 public byte[] ToByteArray() {
   var builder = new ByteBuilder(300);
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_ServiceType.Value)));
   builder.Add(_SourceAddressTon);
   builder.Add(_SourceAddressNpi);
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_SourceAddress)));
   builder.Add(_DestinationAddressTon);
   builder.Add(_DestinationAddressNpi);
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_DestinationAddress)));
   builder.Add(_EsmClass.Value);
   builder.Add(_ProtocolId);
   builder.Add(_PriorityFlag);
   if (_ScheduleDeliveryTime == null)
     builder.AddRange(SmppConverter.SmppNullEnd(null));
   else
     builder.AddRange(
       SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_ScheduleDeliveryTime.SmppDate)));
   if (_ValidityPeriod == null)
     builder.AddRange(SmppConverter.SmppNullEnd(null));
   else
     builder.AddRange(
       SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_ValidityPeriod.SmppDate)));
   builder.Add(_RegisteredDelivery.Value);
   builder.Add(_ReplaceIfPresent);
   builder.Add(_ShortMessage.DataCoding.Value);
   builder.Add(_SmDefaultMessageId);
   builder.Add(Convert.ToByte(_ShortMessage.Length));
   builder.AddRange(_ShortMessage.Value);
   return builder.ToArray();
 }
Exemple #15
0
 internal SmppTlv(ByteBuilder bb, int StartPosition) : this(bb.ToArray(StartPosition, bb.Count - StartPosition)) {}
Exemple #16
0
    void ProcessPdu(Guid ConnGuid, ByteBuilder bb) {
      var header = new SmppHeader(bb);
      if (bb.Count > 0x10)
        bb.ToArray(0x10, bb.Count - 0x10);
      if (((header.CommandId == 2) || (header.CommandId == 1)) || (header.CommandId == 9))
        try {
          var pdu = new SmppBindReq(bb);
          if (OnBindReq != null)
            OnBindReq(this, new SmppBindEventArgs(ConnGuid, pdu));
        } catch {}
      else {
        int commandId = header.CommandId;
        if (commandId <= -2147483627)
          switch (commandId) {
            case -2147483643: {
              var res = new SmppDeliverSmRes(bb);
              if (OnDeliverSmRes != null)
                OnDeliverSmRes(this, new SmppDeliverSmResEventArgs(ConnGuid, res));
              return;
            }
            case -2147483627: {
              var res2 = new SmppEnquireLinkRes(bb);
              if (OnEnquireLinkRes != null) {
                OnEnquireLinkRes(this, new SmppEnquireLinkResEventArgs(ConnGuid, res2));
                return;
              }
              break;
            }
          }
        else
          switch (commandId) {
            case 3: {
              var req4 = new SmppQuerySmReq(bb);
              if (OnQuerySmReq != null)
                OnQuerySmReq(this, new SmppQuerySmEventArgs(req4, ConnGuid));
              return;
            }
            case 4: {
              var req2 = new SmppSubmitSmReq(bb);
              if (OnSubmitSmReq != null)
                OnSubmitSmReq(this, new SmppSubmitSmEventArgs(ConnGuid, req2));
              return;
            }
            case 5:
              return;

            case 6: {
              var req5 = new SmppUnBindReq(bb);
              if (OnUnBindReq != null)
                OnUnBindReq(this, new SmppUnBindEventArgs(ConnGuid, req5));
              return;
            }
            case 0x15: {
              var req3 = new SmppEnquireLinkReq(bb);
              if (OnEnquireLinkReq != null)
                OnEnquireLinkReq(this, new SmppEnquireLinkEventArgs(ConnGuid, req3));
              return;
            }
            default:
              return;
          }
      }
    }
Exemple #17
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));
 }
Exemple #18
0
 public byte[] ToByteArray() {
   var builder = new ByteBuilder(100);
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_ServiceType.Value)));
   builder.Add(_SourceAddressTon);
   builder.Add(_SourceAddressNpi);
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_SourceAddress)));
   builder.Add(_DestinationAddressTon);
   builder.Add(_DestinationAddressNpi);
   builder.AddRange(SmppConverter.SmppNullEnd(SmppDataCoding.BaseEncoding.GetBytes(_DestinationAddress)));
   builder.Add(_EsmClass.Value);
   builder.Add(_RegisteredDelivery.Value);
   builder.Add(_DataCoding.Value);
   return builder.ToArray();
 }