Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SmppPduOutbind.cs « SmppServerLib - github.com/ClusterM/smpp-sharp-lib.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f9961b33fc53fdc0678f9ab4c71f1b13e6769c13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Flex.Cluster.Smpp
{
    public class SmppPduOutbind : SmppPdu
    {
        uint offsetSystemId, offsetPassword;

        public string SystemId
        {
            get { return ReadCString(offsetSystemId); }
        }
        public string Password
        {
            get { return ReadCString(offsetPassword); }
        }

        public SmppPduOutbind(string systemId, string password)
            : base(SmppCommandType.outbind)
        {
            if (systemId.Length > 15) throw new ArgumentOutOfRangeException("systemId");
            offsetSystemId = CurrentOffset;
            WriteCString(systemId);

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

        public SmppPduOutbind(byte[] bytes) : this(bytes, (uint)bytes.Length)
        {
        }
        public SmppPduOutbind(byte[] bytes, uint length)
            : base(bytes, length)
        {
            if (CommandId != SmppCommandType.outbind) throw new Exception("Invaid command ID");
            offsetSystemId = 12;
            offsetPassword = FindCStringEnd(offsetSystemId);
        }
    }
}