pypcapkit 1.0.3.post3__pp39-none-any.whl → 1.1.0.post1__pp39-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pcapkit/__init__.py +1 -1
- pcapkit/const/pcapng/option_type.py +25 -1
- pcapkit/const/reg/apptype.py +25 -1
- pcapkit/corekit/fields/collections.py +4 -5
- pcapkit/corekit/fields/field.py +33 -8
- pcapkit/corekit/fields/ipaddress.py +0 -1
- pcapkit/corekit/fields/misc.py +14 -19
- pcapkit/corekit/fields/numbers.py +2 -3
- pcapkit/corekit/fields/strings.py +2 -3
- pcapkit/corekit/infoclass.py +59 -6
- pcapkit/corekit/protochain.py +8 -1
- pcapkit/foundation/registry/protocols.py +30 -51
- pcapkit/protocols/data/__init__.py +4 -4
- pcapkit/protocols/data/internet/__init__.py +4 -4
- pcapkit/protocols/data/internet/mh.py +4 -4
- pcapkit/protocols/data/transport/__init__.py +4 -4
- pcapkit/protocols/data/transport/tcp.py +4 -4
- pcapkit/protocols/internet/mh.py +20 -20
- pcapkit/protocols/protocol.py +3 -2
- pcapkit/protocols/schema/__init__.py +4 -4
- pcapkit/protocols/schema/application/httpv2.py +16 -29
- pcapkit/protocols/schema/internet/__init__.py +4 -4
- pcapkit/protocols/schema/internet/hip.py +62 -111
- pcapkit/protocols/schema/internet/hopopt.py +46 -48
- pcapkit/protocols/schema/internet/ipv4.py +36 -41
- pcapkit/protocols/schema/internet/ipv6_opts.py +48 -52
- pcapkit/protocols/schema/internet/ipv6_route.py +9 -20
- pcapkit/protocols/schema/internet/mh.py +49 -84
- pcapkit/protocols/schema/misc/pcapng.py +178 -195
- pcapkit/protocols/schema/schema.py +252 -53
- pcapkit/protocols/schema/transport/__init__.py +4 -4
- pcapkit/protocols/schema/transport/tcp.py +52 -83
- pcapkit/protocols/transport/tcp.py +14 -14
- pcapkit/vendor/pcapng/option_type.py +25 -1
- pcapkit/vendor/reg/apptype.py +25 -1
- {pypcapkit-1.0.3.post3.dist-info → pypcapkit-1.1.0.post1.dist-info}/METADATA +1 -1
- {pypcapkit-1.0.3.post3.dist-info → pypcapkit-1.1.0.post1.dist-info}/RECORD +41 -41
- {pypcapkit-1.0.3.post3.dist-info → pypcapkit-1.1.0.post1.dist-info}/LICENSE +0 -0
- {pypcapkit-1.0.3.post3.dist-info → pypcapkit-1.1.0.post1.dist-info}/WHEEL +0 -0
- {pypcapkit-1.0.3.post3.dist-info → pypcapkit-1.1.0.post1.dist-info}/entry_points.txt +0 -0
- {pypcapkit-1.0.3.post3.dist-info → pypcapkit-1.1.0.post1.dist-info}/top_level.txt +0 -0
@@ -138,8 +138,8 @@ __all__ = [
|
|
138
138
|
'MH_HomeTestMessage', 'MH_CareofTestMessage', 'MH_BindingUpdateMessage', 'MH_BindingAcknowledgementMessage',
|
139
139
|
'MH_BindingErrorMessage',
|
140
140
|
'MH_Option',
|
141
|
-
'MH_UnassignedOption', 'MH_PadOption', '
|
142
|
-
'MH_NonceIndicesOption', '
|
141
|
+
'MH_UnassignedOption', 'MH_PadOption', 'MH_BindingRefreshAdviceOption', 'MH_AlternateCareofAddressOption',
|
142
|
+
'MH_NonceIndicesOption', 'MH_AuthorizationDataOption', 'MH_MobileNetworkPrefixOption',
|
143
143
|
'MH_LinkLayerAddressOption', 'MH_MNIDOption', 'MH_AuthOption', 'MH_MesgIDOption', 'MH_CGAParametersRequestOption',
|
144
144
|
'MH_CGAParametersOption', 'MH_SignatureOption', 'MH_PermanentHomeKeygenTokenOption', 'MH_CareofTestInitOption',
|
145
145
|
'MH_CareofTestOption',
|
@@ -152,8 +152,8 @@ __all__ = [
|
|
152
152
|
'TCP_Flags', 'TCP_SACKBlock',
|
153
153
|
'TCP_Option',
|
154
154
|
'TCP_UnassignedOption', 'TCP_EndOfOptionList', 'TCP_NoOperation', 'TCP_MaximumSegmentSize', 'TCP_WindowScale',
|
155
|
-
'TCP_SACKPermitted', 'TCP_SACK', 'TCP_Echo', 'TCP_EchoReply', '
|
156
|
-
'
|
155
|
+
'TCP_SACKPermitted', 'TCP_SACK', 'TCP_Echo', 'TCP_EchoReply', 'TCP_Timestamps', 'TCP_PartialOrderConnectionPermitted', # pylint: disable=line-too-long
|
156
|
+
'TCP_PartialOrderServiceProfile', 'TCP_CC', 'TCP_CCNew', 'TCP_CCEcho', 'TCP_AlternateChecksumRequest',
|
157
157
|
'TCP_AlternateChecksumData', 'TCP_MD5Signature', 'TCP_QuickStartResponse', 'TCP_UserTimeout',
|
158
158
|
'TCP_Authentication', 'TCP_FastOpenCookie',
|
159
159
|
'TCP_MPTCPCapableFlag',
|
@@ -179,12 +179,12 @@ from pcapkit.protocols.data.internet.mh import AuthOption as MH_AuthOption
|
|
179
179
|
from pcapkit.protocols.data.internet.mh import \
|
180
180
|
BindingAcknowledgementMessage as MH_BindingAcknowledgementMessage
|
181
181
|
from pcapkit.protocols.data.internet.mh import \
|
182
|
-
|
182
|
+
AuthorizationDataOption as MH_AuthorizationDataOption
|
183
183
|
from pcapkit.protocols.data.internet.mh import BindingErrorMessage as MH_BindingErrorMessage
|
184
184
|
from pcapkit.protocols.data.internet.mh import \
|
185
185
|
BindingRefreshRequestMessage as MH_BindingRefreshRequestMessage
|
186
186
|
from pcapkit.protocols.data.internet.mh import BindingUpdateMessage as MH_BindingUpdateMessage
|
187
|
-
from pcapkit.protocols.data.internet.mh import
|
187
|
+
from pcapkit.protocols.data.internet.mh import BindingRefreshAdviceOption as MH_BindingRefreshAdviceOption
|
188
188
|
from pcapkit.protocols.data.internet.mh import CareofTestInitMessage as MH_CareofTestInitMessage
|
189
189
|
from pcapkit.protocols.data.internet.mh import CareofTestInitOption as MH_CareofTestInitOption
|
190
190
|
from pcapkit.protocols.data.internet.mh import CareofTestMessage as MH_CareofTestMessage
|
@@ -287,8 +287,8 @@ __all__ = [
|
|
287
287
|
'MH_HomeTestMessage', 'MH_CareofTestMessage', 'MH_BindingUpdateMessage', 'MH_BindingAcknowledgementMessage',
|
288
288
|
'MH_BindingErrorMessage',
|
289
289
|
'MH_Option',
|
290
|
-
'MH_UnassignedOption', 'MH_PadOption', '
|
291
|
-
'MH_NonceIndicesOption', '
|
290
|
+
'MH_UnassignedOption', 'MH_PadOption', 'MH_BindingRefreshAdviceOption', 'MH_AlternateCareofAddressOption',
|
291
|
+
'MH_NonceIndicesOption', 'MH_AuthorizationDataOption', 'MH_MobileNetworkPrefixOption',
|
292
292
|
'MH_LinkLayerAddressOption', 'MH_MNIDOption', 'MH_AuthOption', 'MH_MesgIDOption', 'MH_CGAParametersRequestOption',
|
293
293
|
'MH_CGAParametersOption', 'MH_SignatureOption', 'MH_PermanentHomeKeygenTokenOption', 'MH_CareofTestInitOption',
|
294
294
|
'MH_CareofTestOption',
|
@@ -70,8 +70,8 @@ __all__ = [
|
|
70
70
|
'BindingErrorMessage',
|
71
71
|
|
72
72
|
'Option',
|
73
|
-
'UnassignedOption', 'PadOption', '
|
74
|
-
'NonceIndicesOption', '
|
73
|
+
'UnassignedOption', 'PadOption', 'BindingRefreshAdviceOption', 'AlternateCareofAddressOption',
|
74
|
+
'NonceIndicesOption', 'AuthorizationDataOption', 'MobileNetworkPrefixOption',
|
75
75
|
'LinkLayerAddressOption', 'MNIDOption', 'AuthOption', 'MesgIDOption', 'CGAParametersRequestOption',
|
76
76
|
'CGAParametersOption', 'SignatureOption', 'PermanentHomeKeygenTokenOption', 'CareofTestInitOption',
|
77
77
|
'CareofTestOption',
|
@@ -281,7 +281,7 @@ class PadOption(Option):
|
|
281
281
|
|
282
282
|
|
283
283
|
@info_final
|
284
|
-
class
|
284
|
+
class BindingRefreshAdviceOption(Option):
|
285
285
|
"""Data model for Binding Refresh Advice option."""
|
286
286
|
|
287
287
|
#: Refresh interval.
|
@@ -316,7 +316,7 @@ class NonceIndicesOption(Option):
|
|
316
316
|
|
317
317
|
|
318
318
|
@info_final
|
319
|
-
class
|
319
|
+
class AuthorizationDataOption(Option):
|
320
320
|
"""Data model for Binding Authorization Data option."""
|
321
321
|
|
322
322
|
#: Authenticator.
|
@@ -37,11 +37,11 @@ from pcapkit.protocols.data.transport.tcp import Option as TCP_Option
|
|
37
37
|
from pcapkit.protocols.data.transport.tcp import \
|
38
38
|
PartialOrderConnectionPermitted as TCP_PartialOrderConnectionPermitted
|
39
39
|
from pcapkit.protocols.data.transport.tcp import \
|
40
|
-
|
40
|
+
PartialOrderServiceProfile as TCP_PartialOrderServiceProfile
|
41
41
|
from pcapkit.protocols.data.transport.tcp import QuickStartResponse as TCP_QuickStartResponse
|
42
42
|
from pcapkit.protocols.data.transport.tcp import SACKBlock as TCP_SACKBlock
|
43
43
|
from pcapkit.protocols.data.transport.tcp import SACKPermitted as TCP_SACKPermitted
|
44
|
-
from pcapkit.protocols.data.transport.tcp import
|
44
|
+
from pcapkit.protocols.data.transport.tcp import Timestamps as TCP_Timestamps
|
45
45
|
from pcapkit.protocols.data.transport.tcp import UnassignedOption as TCP_UnassignedOption
|
46
46
|
from pcapkit.protocols.data.transport.tcp import UserTimeout as TCP_UserTimeout
|
47
47
|
from pcapkit.protocols.data.transport.tcp import WindowScale as TCP_WindowScale
|
@@ -55,8 +55,8 @@ __all__ = [
|
|
55
55
|
'TCP_Flags', 'TCP_SACKBlock',
|
56
56
|
'TCP_Option',
|
57
57
|
'TCP_UnassignedOption', 'TCP_EndOfOptionList', 'TCP_NoOperation', 'TCP_MaximumSegmentSize', 'TCP_WindowScale',
|
58
|
-
'TCP_SACKPermitted', 'TCP_SACK', 'TCP_Echo', 'TCP_EchoReply', '
|
59
|
-
'
|
58
|
+
'TCP_SACKPermitted', 'TCP_SACK', 'TCP_Echo', 'TCP_EchoReply', 'TCP_Timestamps', 'TCP_PartialOrderConnectionPermitted', # pylint: disable=line-too-long
|
59
|
+
'TCP_PartialOrderServiceProfile', 'TCP_CC', 'TCP_CCNew', 'TCP_CCEcho', 'TCP_AlternateChecksumRequest',
|
60
60
|
'TCP_AlternateChecksumData', 'TCP_MD5Signature', 'TCP_QuickStartResponse', 'TCP_UserTimeout',
|
61
61
|
'TCP_Authentication', 'TCP_FastOpenCookie',
|
62
62
|
'TCP_MPTCPCapableFlag',
|
@@ -27,8 +27,8 @@ __all__ = [
|
|
27
27
|
|
28
28
|
'Option',
|
29
29
|
'UnassignedOption', 'EndOfOptionList', 'NoOperation', 'MaximumSegmentSize', 'WindowScale',
|
30
|
-
'SACKPermitted', 'SACK', 'Echo', 'EchoReply', '
|
31
|
-
'
|
30
|
+
'SACKPermitted', 'SACK', 'Echo', 'EchoReply', 'Timestamps', 'PartialOrderConnectionPermitted',
|
31
|
+
'PartialOrderServiceProfile', 'CC', 'CCNew', 'CCEcho', 'AlternateChecksumRequest',
|
32
32
|
'AlternateChecksumData', 'MD5Signature', 'QuickStartResponse', 'UserTimeout',
|
33
33
|
'Authentication', 'FastOpenCookie',
|
34
34
|
|
@@ -215,7 +215,7 @@ class EchoReply(Option):
|
|
215
215
|
|
216
216
|
|
217
217
|
@info_final
|
218
|
-
class
|
218
|
+
class Timestamps(Option):
|
219
219
|
"""Data model for TCP timestamp option."""
|
220
220
|
|
221
221
|
#: Timestamp .
|
@@ -236,7 +236,7 @@ class PartialOrderConnectionPermitted(Option):
|
|
236
236
|
|
237
237
|
|
238
238
|
@info_final
|
239
|
-
class
|
239
|
+
class PartialOrderServiceProfile(Option):
|
240
240
|
"""Data model for TCP partial order connection profile option."""
|
241
241
|
|
242
242
|
#: Start flag.
|
pcapkit/protocols/internet/mh.py
CHANGED
@@ -78,15 +78,15 @@ from pcapkit.protocols.data.internet.mh import \
|
|
78
78
|
AlternateCareofAddressOption as Data_AlternateCareofAddressOption
|
79
79
|
from pcapkit.protocols.data.internet.mh import AuthOption as Data_AuthOption
|
80
80
|
from pcapkit.protocols.data.internet.mh import \
|
81
|
-
|
81
|
+
AuthorizationDataOption as Data_AuthorizationDataOption
|
82
82
|
from pcapkit.protocols.data.internet.mh import \
|
83
|
-
|
83
|
+
BindingAcknowledgementMessage as Data_BindingAcknowledgementMessage
|
84
84
|
from pcapkit.protocols.data.internet.mh import BindingErrorMessage as Data_BindingErrorMessage
|
85
|
+
from pcapkit.protocols.data.internet.mh import \
|
86
|
+
BindingRefreshAdviceOption as Data_BindingRefreshAdviceOption
|
85
87
|
from pcapkit.protocols.data.internet.mh import \
|
86
88
|
BindingRefreshRequestMessage as Data_BindingRefreshRequestMessage
|
87
89
|
from pcapkit.protocols.data.internet.mh import BindingUpdateMessage as Data_BindingUpdateMessage
|
88
|
-
from pcapkit.protocols.data.internet.mh import \
|
89
|
-
BindRefreshAdviceOption as Data_BindRefreshAdviceOption
|
90
90
|
from pcapkit.protocols.data.internet.mh import CareofTestInitMessage as Data_CareofTestInitMessage
|
91
91
|
from pcapkit.protocols.data.internet.mh import CareofTestInitOption as Data_CareofTestInitOption
|
92
92
|
from pcapkit.protocols.data.internet.mh import CareofTestMessage as Data_CareofTestMessage
|
@@ -118,15 +118,15 @@ from pcapkit.protocols.schema.internet.mh import \
|
|
118
118
|
AlternateCareofAddressOption as Schema_AlternateCareofAddressOption
|
119
119
|
from pcapkit.protocols.schema.internet.mh import AuthOption as Schema_AuthOption
|
120
120
|
from pcapkit.protocols.schema.internet.mh import \
|
121
|
-
|
121
|
+
AuthorizationDataOption as Schema_AuthorizationDataOption
|
122
122
|
from pcapkit.protocols.schema.internet.mh import \
|
123
|
-
|
123
|
+
BindingAcknowledgementMessage as Schema_BindingAcknowledgementMessage
|
124
124
|
from pcapkit.protocols.schema.internet.mh import BindingErrorMessage as Schema_BindingErrorMessage
|
125
|
+
from pcapkit.protocols.schema.internet.mh import \
|
126
|
+
BindingRefreshAdviceOption as Schema_BindingRefreshAdviceOption
|
125
127
|
from pcapkit.protocols.schema.internet.mh import \
|
126
128
|
BindingRefreshRequestMessage as Schema_BindingRefreshRequestMessage
|
127
129
|
from pcapkit.protocols.schema.internet.mh import BindingUpdateMessage as Schema_BindingUpdateMessage
|
128
|
-
from pcapkit.protocols.schema.internet.mh import \
|
129
|
-
BindRefreshAdviceOption as Schema_BindRefreshAdviceOption
|
130
130
|
from pcapkit.protocols.schema.internet.mh import \
|
131
131
|
CareofTestInitMessage as Schema_CareofTestInitMessage
|
132
132
|
from pcapkit.protocols.schema.internet.mh import CareofTestInitOption as Schema_CareofTestInitOption
|
@@ -1125,8 +1125,8 @@ class MH(Internet[Data_MH, Schema_MH],
|
|
1125
1125
|
)
|
1126
1126
|
return data
|
1127
1127
|
|
1128
|
-
def _read_opt_bra(self, schema: '
|
1129
|
-
options: 'Option') -> '
|
1128
|
+
def _read_opt_bra(self, schema: 'Schema_BindingRefreshAdviceOption', *,
|
1129
|
+
options: 'Option') -> 'Data_BindingRefreshAdviceOption':
|
1130
1130
|
"""Read MH binding refresh advice option.
|
1131
1131
|
|
1132
1132
|
Structure of MH Binding Refresh Advice option [:rfc:`6275`]:
|
@@ -1152,7 +1152,7 @@ class MH(Internet[Data_MH, Schema_MH],
|
|
1152
1152
|
if schema.length != 2:
|
1153
1153
|
raise ProtocolError(f'{self.alias}: [Opt {schema.type}] invalid format')
|
1154
1154
|
|
1155
|
-
data =
|
1155
|
+
data = Data_BindingRefreshAdviceOption(
|
1156
1156
|
type=schema.type,
|
1157
1157
|
length=schema.length + 2,
|
1158
1158
|
interval=schema.interval,
|
@@ -1234,8 +1234,8 @@ class MH(Internet[Data_MH, Schema_MH],
|
|
1234
1234
|
)
|
1235
1235
|
return data
|
1236
1236
|
|
1237
|
-
def _read_opt_bad(self, schema: '
|
1238
|
-
options: 'Option') -> '
|
1237
|
+
def _read_opt_bad(self, schema: 'Schema_AuthorizationDataOption', *,
|
1238
|
+
options: 'Option') -> 'Data_AuthorizationDataOption':
|
1239
1239
|
"""Read MH binding authorization data option.
|
1240
1240
|
|
1241
1241
|
Structure of MH Binding Authorization Data option [:rfc:`6275`]:
|
@@ -1265,7 +1265,7 @@ class MH(Internet[Data_MH, Schema_MH],
|
|
1265
1265
|
if schema.length % 8 != 0:
|
1266
1266
|
raise ProtocolError(f'{self.alias}: [Opt {schema.type}] invalid format')
|
1267
1267
|
|
1268
|
-
data =
|
1268
|
+
data = Data_AuthorizationDataOption(
|
1269
1269
|
type=schema.type,
|
1270
1270
|
length=schema.length + 2,
|
1271
1271
|
data=schema.data,
|
@@ -2196,9 +2196,9 @@ class MH(Internet[Data_MH, Schema_MH],
|
|
2196
2196
|
length=length,
|
2197
2197
|
)
|
2198
2198
|
|
2199
|
-
def _make_opt_bra(self, type: 'Enum_Option', option: 'Optional[
|
2199
|
+
def _make_opt_bra(self, type: 'Enum_Option', option: 'Optional[Data_BindingRefreshAdviceOption]' = None, *,
|
2200
2200
|
interval: 'int' = 0,
|
2201
|
-
**kwargs: 'Any') -> '
|
2201
|
+
**kwargs: 'Any') -> 'Schema_BindingRefreshAdviceOption':
|
2202
2202
|
"""Make MH binding refresh advice option.
|
2203
2203
|
|
2204
2204
|
Args:
|
@@ -2214,7 +2214,7 @@ class MH(Internet[Data_MH, Schema_MH],
|
|
2214
2214
|
if option is not None:
|
2215
2215
|
interval = option.interval
|
2216
2216
|
|
2217
|
-
return
|
2217
|
+
return Schema_BindingRefreshAdviceOption(
|
2218
2218
|
type=type,
|
2219
2219
|
length=2,
|
2220
2220
|
interval=interval,
|
@@ -2272,9 +2272,9 @@ class MH(Internet[Data_MH, Schema_MH],
|
|
2272
2272
|
careof=careof,
|
2273
2273
|
)
|
2274
2274
|
|
2275
|
-
def _make_opt_bad(self, type: 'Enum_Option', option: 'Optional[
|
2275
|
+
def _make_opt_bad(self, type: 'Enum_Option', option: 'Optional[Data_AuthorizationDataOption]' = None, *,
|
2276
2276
|
data: 'bytes' = b'',
|
2277
|
-
**kwargs: 'Any') -> '
|
2277
|
+
**kwargs: 'Any') -> 'Schema_AuthorizationDataOption':
|
2278
2278
|
"""Make MH binding authorization data option.
|
2279
2279
|
|
2280
2280
|
Args:
|
@@ -2293,7 +2293,7 @@ class MH(Internet[Data_MH, Schema_MH],
|
|
2293
2293
|
if len(data) % 8 != 0:
|
2294
2294
|
raise ProtocolError(f'{self.alias}: [OptNo {type}] invalid format')
|
2295
2295
|
|
2296
|
-
return
|
2296
|
+
return Schema_AuthorizationDataOption(
|
2297
2297
|
type=type,
|
2298
2298
|
length=len(data),
|
2299
2299
|
data=data,
|
pcapkit/protocols/protocol.py
CHANGED
@@ -528,12 +528,13 @@ class Protocol(Generic[PT, ST], metaclass=abc.ABCMeta):
|
|
528
528
|
self._info = self.unpack(length, **kwargs)
|
529
529
|
|
530
530
|
def __init_subclass__(cls, /, schema: 'Optional[Type[ST]]' = None,
|
531
|
-
data: 'Optional[Type[PT]]' = None, **kwargs: 'Any') -> 'None':
|
531
|
+
data: 'Optional[Type[PT]]' = None, *args: 'Any', **kwargs: 'Any') -> 'None':
|
532
532
|
"""Initialisation for subclasses.
|
533
533
|
|
534
534
|
Args:
|
535
535
|
schema: Schema class.
|
536
536
|
data: Data class.
|
537
|
+
*args: Arbitrary positional arguments.
|
537
538
|
**kwargs: Arbitrary keyword arguments.
|
538
539
|
|
539
540
|
This method is called when a subclass of :class:`Protocol` is defined.
|
@@ -549,7 +550,7 @@ class Protocol(Generic[PT, ST], metaclass=abc.ABCMeta):
|
|
549
550
|
:class:`~pcapkit.protocols.data.data.Data_Raw` classes will be used.
|
550
551
|
|
551
552
|
"""
|
552
|
-
super().__init_subclass__(
|
553
|
+
super().__init_subclass__()
|
553
554
|
|
554
555
|
if schema is None:
|
555
556
|
schema = cast('Type[ST]', getattr(schema_module, cls.__name__, Schema_Raw))
|
@@ -75,8 +75,8 @@ __all__ = [
|
|
75
75
|
'MH_HomeTestMessage', 'MH_CareofTestMessage', 'MH_BindingUpdateMessage', 'MH_BindingAcknowledgementMessage',
|
76
76
|
'MH_BindingErrorMessage',
|
77
77
|
'MH_Option',
|
78
|
-
'MH_UnassignedOption', 'MH_PadOption', '
|
79
|
-
'MH_NonceIndicesOption', '
|
78
|
+
'MH_UnassignedOption', 'MH_PadOption', 'MH_BindingRefreshAdviceOption', 'MH_AlternateCareofAddressOption',
|
79
|
+
'MH_NonceIndicesOption', 'MH_AuthorizationDataOption', 'MH_MobileNetworkPrefixOption',
|
80
80
|
'MH_LinkLayerAddressOption', 'MH_MNIDOption', 'MH_AuthOption', 'MH_MesgIDOption', 'MH_CGAParametersRequestOption',
|
81
81
|
'MH_CGAParametersOption', 'MH_SignatureOption', 'MH_PermanentHomeKeygenTokenOption', 'MH_CareofTestInitOption',
|
82
82
|
'MH_CareofTestOption',
|
@@ -89,8 +89,8 @@ __all__ = [
|
|
89
89
|
'TCP_SACKBlock',
|
90
90
|
'TCP_Option',
|
91
91
|
'TCP_UnassignedOption', 'TCP_EndOfOptionList', 'TCP_NoOperation', 'TCP_MaximumSegmentSize', 'TCP_WindowScale',
|
92
|
-
'TCP_SACKPermitted', 'TCP_SACK', 'TCP_Echo', 'TCP_EchoReply', '
|
93
|
-
'
|
92
|
+
'TCP_SACKPermitted', 'TCP_SACK', 'TCP_Echo', 'TCP_EchoReply', 'TCP_Timestamps', 'TCP_PartialOrderConnectionPermitted', # pylint: disable=line-too-long
|
93
|
+
'TCP_PartialOrderServiceProfile', 'TCP_CC', 'TCP_CCNew', 'TCP_CCEcho', 'TCP_AlternateChecksumRequest',
|
94
94
|
'TCP_AlternateChecksumData', 'TCP_MD5Signature', 'TCP_QuickStartResponse', 'TCP_UserTimeout',
|
95
95
|
'TCP_Authentication', 'TCP_FastOpenCookie',
|
96
96
|
'TCP_MPTCP',
|
@@ -13,7 +13,7 @@ from pcapkit.corekit.fields.collections import ListField
|
|
13
13
|
from pcapkit.corekit.fields.misc import ConditionalField, SchemaField, SwitchField
|
14
14
|
from pcapkit.corekit.fields.numbers import EnumField, NumberField, UInt8Field, UInt32Field
|
15
15
|
from pcapkit.corekit.fields.strings import BitField, BytesField, PaddingField
|
16
|
-
from pcapkit.protocols.schema.schema import Schema, schema_final
|
16
|
+
from pcapkit.protocols.schema.schema import EnumSchema, Schema, schema_final
|
17
17
|
from pcapkit.utilities.logging import SPHINX_TYPE_CHECKING
|
18
18
|
|
19
19
|
__all__ = [
|
@@ -26,7 +26,7 @@ __all__ = [
|
|
26
26
|
]
|
27
27
|
|
28
28
|
if TYPE_CHECKING:
|
29
|
-
from typing import Any,
|
29
|
+
from typing import Any, Optional
|
30
30
|
|
31
31
|
from pcapkit.corekit.fields.field import _Field as Field
|
32
32
|
|
@@ -79,7 +79,7 @@ def http_frame_selector(pkt: 'dict[str, Any]') -> 'Field':
|
|
79
79
|
|
80
80
|
"""
|
81
81
|
type = cast('Enum_Frame', pkt['type'])
|
82
|
-
schema =
|
82
|
+
schema = FrameType.registry[type]
|
83
83
|
return SchemaField(length=pkt['__length__'], schema=schema)
|
84
84
|
|
85
85
|
|
@@ -115,12 +115,14 @@ class HTTP(Schema):
|
|
115
115
|
def __init__(self, length: 'int', type: 'Enum_Frame', flags: 'FrameFlags', stream: 'StreamID', frame: 'FrameType | bytes') -> 'None': ...
|
116
116
|
|
117
117
|
|
118
|
-
class FrameType(
|
118
|
+
class FrameType(EnumSchema[Enum_Frame]):
|
119
119
|
"""Header schema for HTTP/2 frame payload."""
|
120
120
|
|
121
121
|
if TYPE_CHECKING:
|
122
122
|
__flags__: 'Flags'
|
123
123
|
|
124
|
+
__enum__ = collections.defaultdict(lambda: UnassignedFrame)
|
125
|
+
|
124
126
|
class Flags(enum.IntFlag):
|
125
127
|
"""Flags enumeration for HTTP/2 frames."""
|
126
128
|
|
@@ -158,7 +160,7 @@ class UnassignedFrame(FrameType):
|
|
158
160
|
|
159
161
|
|
160
162
|
@schema_final
|
161
|
-
class DataFrame(FrameType):
|
163
|
+
class DataFrame(FrameType, code=Enum_Frame.DATA):
|
162
164
|
"""Header schema for HTTP/2 ``DATA`` frames."""
|
163
165
|
|
164
166
|
class Flags(FrameType.Flags):
|
@@ -185,7 +187,7 @@ class DataFrame(FrameType):
|
|
185
187
|
|
186
188
|
|
187
189
|
@schema_final
|
188
|
-
class HeadersFrame(FrameType):
|
190
|
+
class HeadersFrame(FrameType, code=Enum_Frame.HEADERS):
|
189
191
|
"""Header schema for HTTP/2 ``HEADERS`` frames."""
|
190
192
|
|
191
193
|
class Flags(FrameType.Flags):
|
@@ -229,7 +231,7 @@ class HeadersFrame(FrameType):
|
|
229
231
|
|
230
232
|
|
231
233
|
@schema_final
|
232
|
-
class PriorityFrame(FrameType):
|
234
|
+
class PriorityFrame(FrameType, code=Enum_Frame.PRIORITY):
|
233
235
|
"""Header schema for HTTP/2 ``PRIORITY`` frames."""
|
234
236
|
|
235
237
|
#: Stream dependency (exclusive, stream ID).
|
@@ -245,7 +247,7 @@ class PriorityFrame(FrameType):
|
|
245
247
|
|
246
248
|
|
247
249
|
@schema_final
|
248
|
-
class RSTStreamFrame(FrameType):
|
250
|
+
class RSTStreamFrame(FrameType, code=Enum_Frame.RST_STREAM):
|
249
251
|
"""Header schema for HTTP/2 ``RST_STREAM`` frames."""
|
250
252
|
|
251
253
|
#: Error code.
|
@@ -269,7 +271,7 @@ class SettingPair(Schema):
|
|
269
271
|
|
270
272
|
|
271
273
|
@schema_final
|
272
|
-
class SettingsFrame(FrameType):
|
274
|
+
class SettingsFrame(FrameType, code=Enum_Frame.SETTINGS):
|
273
275
|
"""Header schema for HTTP/2 ``SETTINGS`` frames."""
|
274
276
|
|
275
277
|
class Flags(FrameType.Flags):
|
@@ -288,7 +290,7 @@ class SettingsFrame(FrameType):
|
|
288
290
|
|
289
291
|
|
290
292
|
@schema_final
|
291
|
-
class PushPromiseFrame(FrameType):
|
293
|
+
class PushPromiseFrame(FrameType, code=Enum_Frame.PUSH_PROMISE):
|
292
294
|
"""Header schema for HTTP/2 ``PUSH_PROMISE`` frames."""
|
293
295
|
|
294
296
|
class Flags(FrameType.Flags):
|
@@ -321,7 +323,7 @@ class PushPromiseFrame(FrameType):
|
|
321
323
|
|
322
324
|
|
323
325
|
@schema_final
|
324
|
-
class PingFrame(FrameType):
|
326
|
+
class PingFrame(FrameType, code=Enum_Frame.PING):
|
325
327
|
"""Header schema for HTTP/2 ``PING`` frames."""
|
326
328
|
|
327
329
|
class Flags(FrameType.Flags):
|
@@ -337,7 +339,7 @@ class PingFrame(FrameType):
|
|
337
339
|
|
338
340
|
|
339
341
|
@schema_final
|
340
|
-
class GoawayFrame(FrameType):
|
342
|
+
class GoawayFrame(FrameType, code=Enum_Frame.GOAWAY):
|
341
343
|
"""Header schema for HTTP/2 ``GOAWAY`` frames."""
|
342
344
|
|
343
345
|
#: Last stream ID.
|
@@ -354,7 +356,7 @@ class GoawayFrame(FrameType):
|
|
354
356
|
|
355
357
|
|
356
358
|
@schema_final
|
357
|
-
class WindowUpdateFrame(FrameType):
|
359
|
+
class WindowUpdateFrame(FrameType, code=Enum_Frame.WINDOW_UPDATE):
|
358
360
|
"""Header schema for HTTP/2 ``WINDOW_UPDATE`` frames."""
|
359
361
|
|
360
362
|
#: Window size increment.
|
@@ -367,7 +369,7 @@ class WindowUpdateFrame(FrameType):
|
|
367
369
|
|
368
370
|
|
369
371
|
@schema_final
|
370
|
-
class ContinuationFrame(FrameType):
|
372
|
+
class ContinuationFrame(FrameType, code=Enum_Frame.CONTINUATION):
|
371
373
|
"""Header schema for HTTP/2 ``CONTINUATION`` frames."""
|
372
374
|
|
373
375
|
class Flags(FrameType.Flags):
|
@@ -380,18 +382,3 @@ class ContinuationFrame(FrameType):
|
|
380
382
|
|
381
383
|
if TYPE_CHECKING:
|
382
384
|
def __init__(self, fragment: 'bytes') -> 'None': ...
|
383
|
-
|
384
|
-
|
385
|
-
#: DefaultDict[Enum_Frame, Type[FrameType]]: Mapping of HTTP/2 frame type numbers to schemas.
|
386
|
-
MAP_HTTP_FRAME = collections.defaultdict(lambda: UnassignedFrame, {
|
387
|
-
Enum_Frame.DATA: DataFrame,
|
388
|
-
Enum_Frame.HEADERS: HeadersFrame,
|
389
|
-
Enum_Frame.PRIORITY: PriorityFrame,
|
390
|
-
Enum_Frame.RST_STREAM: RSTStreamFrame,
|
391
|
-
Enum_Frame.SETTINGS: SettingsFrame,
|
392
|
-
Enum_Frame.PUSH_PROMISE: PushPromiseFrame,
|
393
|
-
Enum_Frame.PING: PingFrame,
|
394
|
-
Enum_Frame.GOAWAY: GoawayFrame,
|
395
|
-
Enum_Frame.WINDOW_UPDATE: WindowUpdateFrame,
|
396
|
-
Enum_Frame.CONTINUATION: ContinuationFrame,
|
397
|
-
}) # type: DefaultDict[Enum_Frame | int, Type[FrameType]]
|
@@ -176,13 +176,13 @@ from pcapkit.protocols.schema.internet.mh import AuthOption as MH_AuthOption
|
|
176
176
|
from pcapkit.protocols.schema.internet.mh import \
|
177
177
|
BindingAcknowledgementMessage as MH_BindingAcknowledgementMessage
|
178
178
|
from pcapkit.protocols.schema.internet.mh import \
|
179
|
-
|
179
|
+
AuthorizationDataOption as MH_AuthorizationDataOption
|
180
180
|
from pcapkit.protocols.schema.internet.mh import BindingErrorMessage as MH_BindingErrorMessage
|
181
181
|
from pcapkit.protocols.schema.internet.mh import \
|
182
182
|
BindingRefreshRequestMessage as MH_BindingRefreshRequestMessage
|
183
183
|
from pcapkit.protocols.schema.internet.mh import BindingUpdateMessage as MH_BindingUpdateMessage
|
184
184
|
from pcapkit.protocols.schema.internet.mh import \
|
185
|
-
|
185
|
+
BindingRefreshAdviceOption as MH_BindingRefreshAdviceOption
|
186
186
|
from pcapkit.protocols.schema.internet.mh import CareofTestInitMessage as MH_CareofTestInitMessage
|
187
187
|
from pcapkit.protocols.schema.internet.mh import CareofTestInitOption as MH_CareofTestInitOption
|
188
188
|
from pcapkit.protocols.schema.internet.mh import CareofTestMessage as MH_CareofTestMessage
|
@@ -283,8 +283,8 @@ __all__ = [
|
|
283
283
|
'MH_HomeTestMessage', 'MH_CareofTestMessage', 'MH_BindingUpdateMessage', 'MH_BindingAcknowledgementMessage',
|
284
284
|
'MH_BindingErrorMessage',
|
285
285
|
'MH_Option',
|
286
|
-
'MH_UnassignedOption', 'MH_PadOption', '
|
287
|
-
'MH_NonceIndicesOption', '
|
286
|
+
'MH_UnassignedOption', 'MH_PadOption', 'MH_BindingRefreshAdviceOption', 'MH_AlternateCareofAddressOption',
|
287
|
+
'MH_NonceIndicesOption', 'MH_AuthorizationDataOption', 'MH_MobileNetworkPrefixOption',
|
288
288
|
'MH_LinkLayerAddressOption', 'MH_MNIDOption', 'MH_AuthOption', 'MH_MesgIDOption', 'MH_CGAParametersRequestOption',
|
289
289
|
'MH_CGAParametersOption', 'MH_SignatureOption', 'MH_PermanentHomeKeygenTokenOption', 'MH_CareofTestInitOption',
|
290
290
|
'MH_CareofTestOption',
|