@@ -864,6 +864,7 @@ def read(self, length: 'Optional[int]' = None, *, _read: 'bool' = True,
864
864
Structure of PCAP-NG file blocks:
865
865
866
866
.. code-block:: text
867
+
867
868
1 2 3
868
869
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
869
870
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -1753,7 +1754,7 @@ def _read_block_dsb(self, schema: 'Schema_DecryptionSecretsBlock', *,
1753
1754
if isinstance (name , str ):
1754
1755
meth_name = f'_read_secrets_{ name } '
1755
1756
meth = cast ('SecretsParser' ,
1756
- getattr (self , meth_name , self ._read_secrest_unknown ))
1757
+ getattr (self , meth_name , self ._read_secrets_unknown ))
1757
1758
else :
1758
1759
meth = name [0 ]
1759
1760
secrets_data = meth (schema .secrets_data , block = schema )
@@ -3097,7 +3098,7 @@ def _read_record_ipv6(self, schema: 'Schema_IPv6Record', *,
3097
3098
)
3098
3099
return record
3099
3100
3100
- def _read_secrest_unknown (self , schema : 'Schema_UnknownSecrets' , * ,
3101
+ def _read_secrets_unknown (self , schema : 'Schema_UnknownSecrets' , * ,
3101
3102
block : 'Schema_DecryptionSecretsBlock' ) -> 'Data_UnknownSecrets' :
3102
3103
"""Read PCAP-NG unknown secrets.
3103
3104
@@ -3148,7 +3149,7 @@ def _read_secrets_zigbee_nwk(self, schema: 'Schema_ZigBeeNWKKey', *,
3148
3149
3149
3150
Structure of ZigBee NWK Key secrets:
3150
3151
3151
- .. code-block::
3152
+ .. code-block:: text
3152
3153
3153
3154
0 1 2 3
3154
3155
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@@ -4339,6 +4340,37 @@ def _make_option_if_fcslen(self, type: 'Enum_OptionType', option: 'Optional[Data
4339
4340
fcslen = fcs_length ,
4340
4341
)
4341
4342
4343
+ def _make_option_if_tsoffset (self , type : 'Enum_OptionType' , option : 'Optional[Data_IF_TSOffsetOption]' = None , * ,
4344
+ offset : 'int' = 0 ,
4345
+ ** kwargs : 'Any' ) -> 'Schema_IF_TSOffsetOption' :
4346
+ """Make PCAP-NG ``if_tsoffset`` option.
4347
+
4348
+ Args:
4349
+ type: Option type.
4350
+ option: Option data model.
4351
+ offset: Timestamp offset in seconds.
4352
+ **kwargs: Arbitrary keyword arguments.
4353
+
4354
+ Returns:
4355
+ Constructed option schema.
4356
+
4357
+ """
4358
+ if self ._type != Enum_BlockType .Interface_Description_Block :
4359
+ raise ProtocolError (f'PCAP-NG: [if_tsoffset] option must be in Interface Description Block, '
4360
+ f'but found in { self ._type } block.' )
4361
+ if self ._opt [type ] > 0 :
4362
+ raise ProtocolError (f'PCAP-NG: [if_tsoffset] option must be only one, '
4363
+ f'but { self ._opt [type ] + 1 } found.' )
4364
+
4365
+ if option is not None :
4366
+ offset = option .offset
4367
+
4368
+ return Schema_IF_TSOffsetOption (
4369
+ type = type ,
4370
+ length = 8 ,
4371
+ tsoffset = offset ,
4372
+ )
4373
+
4342
4374
def _make_option_if_hardware (self , type : 'Enum_OptionType' , option : 'Optional[Data_IF_HardwareOption]' = None , * ,
4343
4375
hardware : 'str' = platform .processor (),
4344
4376
** kwargs : 'Any' ) -> 'Schema_IF_HardwareOption' :
0 commit comments