33
33
'PCAPNG' ,
34
34
35
35
'Option' , 'UnknownOption' ,
36
- 'EndOfOption' , 'CommentOption' ,
36
+ 'EndOfOption' , 'CommentOption' , 'CustomOption' ,
37
37
'IF_NameOption' , 'IF_DescriptionOption' , 'IF_IPv4AddrOption' , 'IF_IPv6AddrOption' ,
38
38
'IF_MACAddrOption' , 'IF_EUIAddrOption' , 'IF_SpeedOption' , 'IF_TSResolOption' ,
39
39
'IF_TZoneOption' , 'IF_FilterOption' , 'IF_OSOption' , 'IF_FCSLenOption' ,
@@ -283,7 +283,7 @@ class UnknownOption(Option):
283
283
padding : 'bytes' = PaddingField (length = lambda pkt : (4 - pkt ['length' ] % 4 ) % 4 )
284
284
285
285
if TYPE_CHECKING :
286
- def __init__ (self , type : 'int' , length : 'int' , data : 'bytes' , padding : 'bytes' ) -> 'None' : ...
286
+ def __init__ (self , type : 'int' , length : 'int' , data : 'bytes' ) -> 'None' : ...
287
287
288
288
289
289
class EndOfOption (Option ):
@@ -302,7 +302,21 @@ class CommentOption(Option):
302
302
padding : 'bytes' = PaddingField (length = lambda pkt : (4 - pkt ['length' ] % 4 ) % 4 )
303
303
304
304
if TYPE_CHECKING :
305
- def __init__ (self , type : 'int' , length : 'int' , comment : 'str' , padding : 'bytes' ) -> 'None' : ...
305
+ def __init__ (self , type : 'int' , length : 'int' , comment : 'str' ) -> 'None' : ...
306
+
307
+
308
+ class CustomOption (Option ):
309
+ """Header schema for PCAP-NG file ``opt_custom`` options."""
310
+
311
+ #: Private enterprise number (PEN).
312
+ pen : 'int' = UInt32Field (callback = byteorder_callback )
313
+ #: Custom data.
314
+ data : 'bytes' = BytesField (length = lambda pkt : pkt ['length' ] - 4 )
315
+ #: Padding.
316
+ padding : 'bytes' = PaddingField (length = lambda pkt : (4 - pkt ['length' ] % 4 ) % 4 )
317
+
318
+ if TYPE_CHECKING :
319
+ def __init__ (self , type : 'int' , length : 'int' , pen : 'int' , data : 'bytes' ) -> 'None' : ...
306
320
307
321
308
322
class SectionHeaderBlock (BlockType ):
@@ -315,7 +329,7 @@ class SectionHeaderBlock(BlockType):
315
329
#: Block total length.
316
330
length : 'int' = UInt32Field (callback = shb_byteorder_callback )
317
331
#: Byte order magic number.
318
- magic : 'int ' = UInt32Field (callback = shb_byteorder_callback )
332
+ magic : 'Literal[0x1A2B3C4D] ' = UInt32Field (callback = shb_byteorder_callback )
319
333
#: Major version number.
320
334
major : 'int' = UInt16Field (callback = shb_byteorder_callback , default = 1 )
321
335
#: Minor version number.
@@ -382,8 +396,9 @@ def post_process(self, packet: 'dict[str, Any]') -> 'SectionHeaderBlock':
382
396
#: Byteorder.
383
397
byteorder : Literal ['big' , 'little' ]
384
398
385
- def __init__ (self , length : 'int' , magic : 'int' , major : 'int' ,
386
- minor : 'int' , section_length : 'int' , options : 'list[Option | bytes] | bytes' , length2 : 'int' ) -> 'None' : ...
399
+ def __init__ (self , length : 'int' , magic : 'Literal[0x1A2B3C4D]' , major : 'int' ,
400
+ minor : 'int' , section_length : 'int' , options : 'list[Option | bytes] | bytes' ,
401
+ length2 : 'int' ) -> 'None' : ...
387
402
388
403
389
404
class IF_NameOption (Option ):
@@ -395,7 +410,7 @@ class IF_NameOption(Option):
395
410
padding : 'bytes' = PaddingField (length = lambda pkt : (4 - pkt ['length' ] % 4 ) % 4 )
396
411
397
412
if TYPE_CHECKING :
398
- def __init__ (self , type : 'int' , length : 'int' , name : 'str' , padding : 'bytes' ) -> 'None' : ...
413
+ def __init__ (self , type : 'int' , length : 'int' , name : 'str' ) -> 'None' : ...
399
414
400
415
401
416
class IF_DescriptionOption (Option ):
@@ -407,7 +422,7 @@ class IF_DescriptionOption(Option):
407
422
padding : 'bytes' = PaddingField (length = lambda pkt : (4 - pkt ['length' ] % 4 ) % 4 )
408
423
409
424
if TYPE_CHECKING :
410
- def __init__ (self , type : 'int' , length : 'int' , description : 'str' , padding : 'bytes' ) -> 'None' : ...
425
+ def __init__ (self , type : 'int' , length : 'int' , description : 'str' ) -> 'None' : ...
411
426
412
427
413
428
class IF_IPv4AddrOption (Option ):
@@ -860,7 +875,7 @@ def post_process(self, packet: 'dict[str, Any]') -> 'Schema':
860
875
#: Name resolution records.
861
876
names : 'list[str]'
862
877
863
- def __init__ (self , type : 'Enum_RecordType' , length : 'int' , ip : 'IPv4Address' , resol : 'str' , padding : 'bytes' ) -> 'None' : ...
878
+ def __init__ (self , type : 'Enum_RecordType' , length : 'int' , ip : 'IPv4Address' , resol : 'str' ) -> 'None' : ...
864
879
865
880
866
881
class IPv6Record (NameResolutionRecord ):
@@ -890,7 +905,7 @@ def post_process(self, packet: 'dict[str, Any]') -> 'Schema':
890
905
#: Name resolution records.
891
906
names : 'list[str]'
892
907
893
- def __init__ (self , type : 'Enum_RecordType' , length : 'int' , ip : 'IPv4Address' , resol : 'str' , padding : 'bytes' ) -> 'None' : ...
908
+ def __init__ (self , type : 'Enum_RecordType' , length : 'int' , ip : 'IPv4Address' , resol : 'str' ) -> 'None' : ...
894
909
895
910
896
911
class NS_DNSNameOption (Option ):
0 commit comments