Skip to content

Commit 8a31f33

Browse files
committed
Instead of having a field for "flags", split it to the different flags (RFC 2131 only has Broadcast).
1 parent f10975f commit 8a31f33

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

PcapDotNet/src/PcapDotNet.Packets/Dhcp/DhcpDatagram.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ public DhcpFlags Flags
136136
get { return (DhcpFlags)ReadUShort(Offset.Flags, Endianity.Big); }
137137
}
138138

139+
/// <summary>
140+
/// Whether the broadcast-flag is set.
141+
/// </summary>
142+
public bool Broadcast
143+
{
144+
get { return Flags.HasFlag(DhcpFlags.Broadcast); }
145+
}
146+
139147
/// <summary>
140148
/// RFC 2131.
141149
/// Client IP address; only filled in if client is in BOUND, RENEW or REBINDING state and can respond to ARP requests.

PcapDotNet/src/PcapDotNet.Packets/Dhcp/DhcpLayer.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,28 @@ public sealed class DhcpLayer : SimpleLayer, IEquatable<DhcpLayer>
5353
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags")]
5454
public DhcpFlags DhcpFlags { get; set; }
5555

56+
/// <summary>
57+
/// Whether the broadcast-flag is set.
58+
/// </summary>
59+
public bool Broadcast
60+
{
61+
get
62+
{
63+
return DhcpFlags.HasFlag(DhcpFlags.Broadcast);
64+
}
65+
set
66+
{
67+
if (value)
68+
{
69+
DhcpFlags |= DhcpFlags.Broadcast;
70+
}
71+
else
72+
{
73+
DhcpFlags &= ~DhcpFlags.Broadcast;
74+
}
75+
}
76+
}
77+
5678
/// <summary>
5779
/// Client IP address; only filled in if client is in BOUND, RENEW or REBINDING state and can respond to ARP requests.
5880
/// </summary>

0 commit comments

Comments
 (0)