-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSMPPMessage.cs
62 lines (56 loc) · 1.87 KB
/
SMPPMessage.cs
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using Jannesen.Protocol.SMPP.Internal;
namespace Jannesen.Protocol.SMPP
{
public abstract class SMPPMessage
{
public abstract CommandSet Command { get; }
public CommandStatus Status { get; set; }
public UInt32 Sequence { get; set; }
protected SMPPMessage()
{
}
protected SMPPMessage(UInt32 sequence)
{
Sequence = sequence;
}
internal SMPPMessage(PduReader reader)
{
Status = reader.CommandStatus;
Sequence = reader.CommandSequence;
}
internal virtual void Serialize(PduWriter writer)
{
throw new SMPPException("Can't send message " + Command + ".");
}
}
public abstract class SMPPMessageWithOptional: SMPPMessage
{
private SMPPTLVCollection _optional;
public SMPPTLVCollection Optional
{
get {
if (_optional == null)
_optional = new SMPPTLVCollection();
return _optional;
}
}
public bool hasOptional
{
get {
return _optional != null;
}
}
protected SMPPMessageWithOptional()
{
}
internal SMPPMessageWithOptional(PduReader reader): base(reader)
{
}
internal void ReadOptional(PduReader reader)
{
while (reader.SizeLeft > 0)
Optional.Add(new SMPPTLV(reader));
}
}
}