Skip to content

Commit 5170fe1

Browse files
committed
change method order public, internal, private
1 parent 2912854 commit 5170fe1

File tree

1 file changed

+39
-38
lines changed

1 file changed

+39
-38
lines changed

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

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -247,44 +247,6 @@ public IReadOnlyCollection<DhcpOption> Options
247247
}
248248
}
249249

250-
internal DhcpDatagram(byte[] buffer, int offset, int length) : base(buffer, offset, length)
251-
{
252-
}
253-
254-
private void ParseServerHostName()
255-
{
256-
if (_serverHostName == null)
257-
{
258-
//at the moment we only interpret server host name as sname and ignore options
259-
byte[] byteServerHostName = ReadBytes(Offset.Sname, 64);
260-
_serverHostName = Encoding.ASCII.GetString(byteServerHostName).TrimEnd('\0');
261-
}
262-
}
263-
264-
private void ParseBootFileName()
265-
{
266-
if (_bootFileName == null)
267-
{
268-
//at the moment we only interpret server host name as sname and ignore options
269-
byte[] byteBootFileName = ReadBytes(Offset.File, 128);
270-
_bootFileName = Encoding.ASCII.GetString(byteBootFileName).TrimEnd('\0');
271-
}
272-
}
273-
274-
private void ParseOptions()
275-
{
276-
if (_options == null)
277-
{
278-
List<DhcpOption> options = new List<DhcpOption>();
279-
int offset = IsDhcp ? Offset.OptionsWithMagicCookie : Offset.Options;
280-
while (offset < Length)
281-
{
282-
options.Add(DhcpOption.CreateInstance(this, ref offset));
283-
}
284-
_options = new ReadOnlyCollection<DhcpOption>(options);
285-
}
286-
}
287-
288250
/// <summary>
289251
/// Creates a Layer that represents the datagram to be used with PacketBuilder.
290252
/// </summary>
@@ -311,6 +273,11 @@ public override ILayer ExtractLayer()
311273
};
312274
}
313275

276+
277+
internal DhcpDatagram(byte[] buffer, int offset, int length) : base(buffer, offset, length)
278+
{
279+
}
280+
314281
internal static int GetLength(bool isDhcp, IList<DhcpOption> options)
315282
{
316283
int length = isDhcp ? Offset.OptionsWithMagicCookie : Offset.Options;
@@ -361,6 +328,40 @@ internal static void Write(byte[] buffer, int offset, DhcpMessageType messageTyp
361328
}
362329
}
363330

331+
private void ParseServerHostName()
332+
{
333+
if (_serverHostName == null)
334+
{
335+
//at the moment we only interpret server host name as sname and ignore options
336+
byte[] byteServerHostName = ReadBytes(Offset.Sname, 64);
337+
_serverHostName = Encoding.ASCII.GetString(byteServerHostName).TrimEnd('\0');
338+
}
339+
}
340+
341+
private void ParseBootFileName()
342+
{
343+
if (_bootFileName == null)
344+
{
345+
//at the moment we only interpret server host name as sname and ignore options
346+
byte[] byteBootFileName = ReadBytes(Offset.File, 128);
347+
_bootFileName = Encoding.ASCII.GetString(byteBootFileName).TrimEnd('\0');
348+
}
349+
}
350+
351+
private void ParseOptions()
352+
{
353+
if (_options == null)
354+
{
355+
List<DhcpOption> options = new List<DhcpOption>();
356+
int offset = IsDhcp ? Offset.OptionsWithMagicCookie : Offset.Options;
357+
while (offset < Length)
358+
{
359+
options.Add(DhcpOption.CreateInstance(this, ref offset));
360+
}
361+
_options = new ReadOnlyCollection<DhcpOption>(options);
362+
}
363+
}
364+
364365
private string _serverHostName;
365366
private string _bootFileName;
366367
private IReadOnlyCollection<DhcpOption> _options;

0 commit comments

Comments
 (0)