@@ -247,44 +247,6 @@ public IReadOnlyCollection<DhcpOption> Options
247
247
}
248
248
}
249
249
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
-
288
250
/// <summary>
289
251
/// Creates a Layer that represents the datagram to be used with PacketBuilder.
290
252
/// </summary>
@@ -311,6 +273,11 @@ public override ILayer ExtractLayer()
311
273
} ;
312
274
}
313
275
276
+
277
+ internal DhcpDatagram ( byte [ ] buffer , int offset , int length ) : base ( buffer , offset , length )
278
+ {
279
+ }
280
+
314
281
internal static int GetLength ( bool isDhcp , IList < DhcpOption > options )
315
282
{
316
283
int length = isDhcp ? Offset . OptionsWithMagicCookie : Offset . Options ;
@@ -361,6 +328,40 @@ internal static void Write(byte[] buffer, int offset, DhcpMessageType messageTyp
361
328
}
362
329
}
363
330
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
+
364
365
private string _serverHostName ;
365
366
private string _bootFileName ;
366
367
private IReadOnlyCollection < DhcpOption > _options ;
0 commit comments