Skip to content

Commit fd8e27e

Browse files
committed
added MH CGA related const/vendor
1 parent 561c037 commit fd8e27e

File tree

13 files changed

+573
-4
lines changed

13 files changed

+573
-4
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167
"magn",
168168
"maxt",
169169
"mdid",
170+
"mesg",
170171
"mflg",
171172
"micv",
172173
"MNID",

docs/source/pcapkit/const/mh.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ enumerations include:
8686
- LMA-Controlled MAG Parameters Sub-Option Type Values [*]_
8787
* - :class:`MH_LLACode <pcapkit.const.mh.lla_code.LLACode>`
8888
- Link-Layer Address (LLA) Option Code [*]_
89+
* - :class:`MH_CGAType <pcapkit.const.mh.cga_type.CGAType>`
90+
- CGA Extension Type Tags [*]_
91+
* - :class:`MH_CGAExtension <pcapkit.const.mh.cga_type.CGAExtension>`
92+
- CGA Extension Type Values [*]_
93+
* - :class:`MH_CGASec <pcapkit.const.mh.cga_sec.CGASec>`
94+
- CGA SEC [*]_
8995

9096
Access Technology Type Option Type Values
9197
=========================================
@@ -581,6 +587,45 @@ which is automatically generated from :class:`pcapkit.vendor.mh.lla_code.LLACode
581587
:undoc-members:
582588
:show-inheritance:
583589

590+
CGA Extension Type Tags
591+
=======================
592+
593+
.. module:: pcapkit.const.mh.cga_type
594+
595+
This module contains the constant enumeration for **CGA Extension Type Tags**,
596+
which is automatically generated from :class:`pcapkit.vendor.mh.cga_type.CGAType`.
597+
598+
.. autoclass:: pcapkit.const.mh.cga_type.CGAType
599+
:members:
600+
:undoc-members:
601+
:show-inheritance:
602+
603+
CGA Extension Type Values
604+
===============================
605+
606+
.. module:: pcapkit.const.mh.cga_extension
607+
608+
This module contains the constant enumeration for **CGA Extension Type Values**,
609+
which is automatically generated from :class:`pcapkit.vendor.mh.cga_extension.CGAExtension`.
610+
611+
.. autoclass:: pcapkit.const.mh.cga_extension.CGAExtension
612+
:members:
613+
:undoc-members:
614+
:show-inheritance:
615+
616+
CGA SEC
617+
=======
618+
619+
.. module:: pcapkit.const.mh.cga_sec
620+
621+
This module contains the constant enumeration for **CGA SEC**,
622+
which is automatically generated from :class:`pcapkit.vendor.mh.cga_sec.CGASec`.
623+
624+
.. autoclass:: pcapkit.const.mh.cga_sec.CGASec
625+
:members:
626+
:undoc-members:
627+
:show-inheritance:
628+
584629
.. raw:: html
585630

586631
<hr />
@@ -623,3 +668,6 @@ which is automatically generated from :class:`pcapkit.vendor.mh.lla_code.LLACode
623668
.. [*] https://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml#qos-attribute
624669
.. [*] https://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml#lma-controlled-mag-parameters-sub-option-type
625670
.. [*] :rfc:`5568#section-6.4.3`
671+
.. [*] https://www.iana.org/assignments/cga-message-types/cga-message-types.xhtml#cga-message-types-1
672+
.. [*] https://www.iana.org/assignments/cga-message-types/cga-message-types.xhtml#cga-message-types-2
673+
.. [*] https://www.iana.org/assignments/cga-message-types/cga-message-types.xhtml#cga-message-types-3

docs/source/pcapkit/vendor/mh.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ vendor crawlers include:
8686
- LMA-Controlled MAG Parameters Sub-Option Type Values [*]_
8787
* - :class:`MH_LLACode <pcapkit.vendor.mh.lla_code.LLACode>`
8888
- Link-Layer Address (LLA) Option Code [*]_
89+
* - :class:`MH_CGAType <pcapkit.vendor.mh.cga_type.CGAType>`
90+
- CGA Extension Type Tags [*]_
91+
* - :class:`MH_CGAExtension <pcapkit.vendor.mh.cga_type.CGAExtension>`
92+
- CGA Extension Type Values [*]_
93+
* - :class:`MH_CGASec <pcapkit.vendor.mh.cga_sec.CGASec>`
94+
- CGA SEC [*]_
8995

9096
Access Technology Type Option Type Values
9197
=========================================
@@ -543,6 +549,42 @@ which is automatically generating :class:`pcapkit.const.mh.lla_code.LLACode`.
543549
:members: FLAG, LINK
544550
:show-inheritance:
545551

552+
CGA Extension Type Tags
553+
=======================
554+
555+
.. module:: pcapkit.vendor.mh.cga_type
556+
557+
This module contains the vendor crawler for **CGA Extension Type Tags**,
558+
which is automatically generating :class:`pcapkit.const.mh.cga_type.CGAType`.
559+
560+
.. autoclass:: pcapkit.vendor.mh.cga_type.CGAType
561+
:members: FLAG, LINK
562+
:show-inheritance:
563+
564+
CGA Extension Type Values
565+
=========================
566+
567+
.. module:: pcapkit.vendor.mh.cga_extension
568+
569+
This module contains the vendor crawler for **CGA Extension Type Values**,
570+
which is automatically generating :class:`pcapkit.const.mh.cga_extension.CGAExtension`.
571+
572+
.. autoclass:: pcapkit.vendor.mh.cga_extension.CGAExtension
573+
:members: FLAG, LINK
574+
:show-inheritance:
575+
576+
CGA SEC
577+
=======
578+
579+
.. module:: pcapkit.vendor.mh.cga_sec
580+
581+
This module contains the vendor crawler for **CGA SEC**,
582+
which is automatically generating :class:`pcapkit.const.mh.cga_sec.CGASec`.
583+
584+
.. autoclass:: pcapkit.vendor.mh.cga_sec.CGASec
585+
:members: FLAG, LINK
586+
:show-inheritance:
587+
546588
.. raw:: html
547589

548590
<hr />
@@ -585,3 +627,6 @@ which is automatically generating :class:`pcapkit.const.mh.lla_code.LLACode`.
585627
.. [*] https://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml#qos-attribute
586628
.. [*] https://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml#lma-controlled-mag-parameters-sub-option-type
587629
.. [*] :rfc:`5568#section-6.4.3`
630+
.. [*] https://www.iana.org/assignments/cga-message-types/cga-message-types.xhtml#cga-message-types-1
631+
.. [*] https://www.iana.org/assignments/cga-message-types/cga-message-types.xhtml#cga-message-types-2
632+
.. [*] https://www.iana.org/assignments/cga-message-types/cga-message-types.xhtml#cga-message-types-3

pcapkit/const/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@
6666
'MH_UpdateNotificationReason', 'MH_UpdateNotificationACKStatus',
6767
'MH_FlowBindingType', 'MH_FlowBindingIndicationTrigger',
6868
'MH_FlowBindingACKStatus', 'MH_FlowBindingAction', 'MH_QoSAttribute',
69-
'MH_LMAControlledMAGSuboption', 'MH_LLACode',
69+
'MH_LMAControlledMAGSuboption', 'MH_LLACode', 'MH_CGAType',
70+
'MH_CGAExtension', 'MH_CGASec',
7071
# OSPF
7172
'OSPF_Authentication', 'OSPF_Packet',
7273
# TCP

pcapkit/const/mh/__init__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@
8787
- LMA-Controlled MAG Parameters Sub-Option Type Values [*]_
8888
* - :class:`MH_LLACode <pcapkit.const.mh.lla_code.LLACode>`
8989
- Link-Layer Address (LLA) Option Code [*]_
90+
* - :class:`MH_CGAType <pcapkit.const.mh.cga_type.CGAType>`
91+
- CGA Extension Type Tags [*]_
92+
* - :class:`MH_CGAExtension <pcapkit.const.mh.cga_type.CGAExtension>`
93+
- CGA Extension Type Values [*]_
94+
* - :class:`MH_CGASec <pcapkit.const.mh.cga_sec.CGASec>`
95+
- CGA SEC [*]_
9096
9197
.. [*] https://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml#mobility-parameters-1
9298
.. [*] https://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml#mobility-parameters-2
@@ -126,6 +132,9 @@
126132
.. [*] https://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml#qos-attribute
127133
.. [*] https://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml#lma-controlled-mag-parameters-sub-option-type
128134
.. [*] :rfc:`5568#section-6.4.3`
135+
.. [*] https://www.iana.org/assignments/cga-message-types/cga-message-types.xhtml#cga-message-types-1
136+
.. [*] https://www.iana.org/assignments/cga-message-types/cga-message-types.xhtml#cga-message-types-2
137+
.. [*] https://www.iana.org/assignments/cga-message-types/cga-message-types.xhtml#cga-message-types-3
129138
130139
"""
131140

@@ -169,6 +178,9 @@
169178
from pcapkit.const.mh.upa_status import \
170179
UpdateNotificationACKStatus as MH_UpdateNotificationACKStatus
171180
from pcapkit.const.mh.upn_reason import UpdateNotificationReason as MH_UpdateNotificationReason
181+
from pcapkit.const.mh.cga_extension import CGAExtension as MH_CGAExtension
182+
from pcapkit.const.mh.cga_type import CGAType as MH_CGAType
183+
from pcapkit.const.mh.cga_sec import CGASec as MH_CGASec
172184

173185
__all__ = [
174186
'MH_Packet', 'MH_Option', 'MH_DNSStatusCode', 'MH_ACKStatusCode',
@@ -183,5 +195,6 @@
183195
'MH_UpdateNotificationReason', 'MH_UpdateNotificationACKStatus',
184196
'MH_FlowBindingType', 'MH_FlowBindingIndicationTrigger',
185197
'MH_FlowBindingACKStatus', 'MH_FlowBindingAction', 'MH_QoSAttribute',
186-
'MH_LMAControlledMAGSuboption', 'MH_LLACode',
198+
'MH_LMAControlledMAGSuboption', 'MH_LLACode', 'MH_CGAType',
199+
'MH_CGAExtension', 'MH_CGASec',
187200
]

pcapkit/const/mh/cga_extension.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# -*- coding: utf-8 -*-
2+
# pylint: disable=line-too-long,consider-using-f-string
3+
"""CGA Extension Type Values
4+
===============================
5+
6+
.. module:: pcapkit.const.mh.cga_extension
7+
8+
This module contains the constant enumeration for **CGA Extension Type Values**,
9+
which is automatically generated from :class:`pcapkit.vendor.mh.cga_extension.CGAExtension`.
10+
11+
"""
12+
13+
from aenum import IntEnum, extend_enum
14+
15+
__all__ = ['CGAExtension']
16+
17+
18+
class CGAExtension(IntEnum):
19+
"""[CGAExtension] CGA Extension Type Values"""
20+
21+
#: Multi-Prefix [:rfc:`5535`]
22+
Multi_Prefix = 0x0012
23+
24+
#: Exp_FFFD (experimental) [:rfc:`4581`]
25+
Exp_FFFD = 0xFFFD
26+
27+
#: Exp_FFFE (experimental) [:rfc:`4581`]
28+
Exp_FFFE = 0xFFFE
29+
30+
#: Exp_FFFF (experimental) [:rfc:`4581`]
31+
Exp_FFFF = 0xFFFF
32+
33+
@staticmethod
34+
def get(key: 'int | str', default: 'int' = -1) -> 'CGAExtension':
35+
"""Backport support for original codes.
36+
37+
Args:
38+
key: Key to get enum item.
39+
default: Default value if not found.
40+
41+
:meta private:
42+
"""
43+
if isinstance(key, int):
44+
return CGAExtension(key)
45+
if key not in CGAExtension._member_map_: # pylint: disable=no-member
46+
return extend_enum(CGAExtension, key, default)
47+
return CGAExtension[key] # type: ignore[misc]
48+
49+
@classmethod
50+
def _missing_(cls, value: 'int') -> 'CGAExtension':
51+
"""Lookup function used when value is not found.
52+
53+
Args:
54+
value: Value to get enum item.
55+
56+
"""
57+
if not (isinstance(value, int) and 0 <= value <= 0xFFFF):
58+
raise ValueError('%r is not a valid %s' % (value, cls.__name__))
59+
if 0x0000 <= value <= 0x0011:
60+
#: Unassigned
61+
return extend_enum(cls, 'Unassigned_%04x' % value, value)
62+
if 0x0013 <= value <= 0xFFFC:
63+
#: Unassigned
64+
return extend_enum(cls, 'Unassigned_%04x' % value, value)
65+
#: Unspecified in the IANA registry
66+
return extend_enum(cls, 'Unassigned_%04x' % value, value)

pcapkit/const/mh/cga_sec.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# -*- coding: utf-8 -*-
2+
# pylint: disable=line-too-long,consider-using-f-string
3+
"""CGA SEC
4+
=============
5+
6+
.. module:: pcapkit.const.mh.cga_sec
7+
8+
This module contains the constant enumeration for **CGA SEC**,
9+
which is automatically generated from :class:`pcapkit.vendor.mh.cga_sec.CGASec`.
10+
11+
"""
12+
13+
from aenum import IntEnum, extend_enum
14+
15+
__all__ = ['CGASec']
16+
17+
18+
class CGASec(IntEnum):
19+
"""[CGASec] CGA SEC"""
20+
21+
#: SHA-1_0hash2bits [:rfc:`4982`]
22+
SHA_1_0hash2bits = 0b000
23+
24+
#: SHA-1_16hash2bits [:rfc:`4982`]
25+
SHA_1_16hash2bits = 0b001
26+
27+
#: SHA-1_32hash2bits [:rfc:`4982`]
28+
SHA_1_32hash2bits = 0b010
29+
30+
@staticmethod
31+
def get(key: 'int | str', default: 'int' = -1) -> 'CGASec':
32+
"""Backport support for original codes.
33+
34+
Args:
35+
key: Key to get enum item.
36+
default: Default value if not found.
37+
38+
:meta private:
39+
"""
40+
if isinstance(key, int):
41+
return CGASec(key)
42+
if key not in CGASec._member_map_: # pylint: disable=no-member
43+
return extend_enum(CGASec, key, default)
44+
return CGASec[key] # type: ignore[misc]
45+
46+
@classmethod
47+
def _missing_(cls, value: 'int') -> 'CGASec':
48+
"""Lookup function used when value is not found.
49+
50+
Args:
51+
value: Value to get enum item.
52+
53+
"""
54+
if not (isinstance(value, int) and 0 <= value <= 0b111):
55+
raise ValueError('%r is not a valid %s' % (value, cls.__name__))
56+
#: Unspecified in the IANA registry
57+
return extend_enum(cls, 'Unassigned_%s' % bin(value)[2:], value)

pcapkit/const/mh/cga_type.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# -*- coding: utf-8 -*-
2+
# pylint: disable=line-too-long,consider-using-f-string
3+
"""CGA Extension Type Tags
4+
=============================
5+
6+
.. module:: pcapkit.const.mh.cga_type
7+
8+
This module contains the constant enumeration for **CGA Extension Type Tags**,
9+
which is automatically generated from :class:`pcapkit.vendor.mh.cga_type.CGAType`.
10+
11+
"""
12+
13+
from aenum import IntEnum, extend_enum
14+
15+
__all__ = ['CGAType']
16+
17+
18+
class CGAType(IntEnum):
19+
"""[CGAType] CGA Extension Type Tags"""
20+
21+
#: 0x086F CA5E 10B2 00C9 9C8C E001 6427 7C08 [:rfc:`3971`]
22+
Tag_086F_CA5E_10B2_00C9_9C8C_E001_6427_7C08 = 0x086F_CA5E_10B2_00C9_9C8C_E001_6427_7C08
23+
24+
#: 0x5F27 0586 8D6C 4C56 A246 9EBB 9B2A 2E13 [:rfc:`4866`]
25+
Tag_5F27_0586_8D6C_4C56_A246_9EBB_9B2A_2E13 = 0x5F27_0586_8D6C_4C56_A246_9EBB_9B2A_2E13
26+
27+
#: 0xF0EF F02F BFF4 3D0F E793 0C3C 6E61 74EA [:rfc:`7401`]
28+
Tag_F0EF_F02F_BFF4_3D0F_E793_0C3C_6E61_74EA = 0xF0EF_F02F_BFF4_3D0F_E793_0C3C_6E61_74EA
29+
30+
#: 0x4A30 5662 4858 574B 3655 416F 506A 6D48 [:rfc:`5533`]
31+
Tag_4A30_5662_4858_574B_3655_416F_506A_6D48 = 0x4A30_5662_4858_574B_3655_416F_506A_6D48
32+
33+
#: 0x09F5 2BE5 3B62 4C76 CB96 4E7F CDC9 2804 [:rfc:`6496`]
34+
Tag_09F5_2BE5_3B62_4C76_CB96_4E7F_CDC9_2804 = 0x09F5_2BE5_3B62_4C76_CB96_4E7F_CDC9_2804
35+
36+
#: 0x8701 55C8 0CCA DD32 6AB7 E415 F148 84D0 [:rfc:`8928`]
37+
Tag_8701_55C8_0CCA_DD32_6AB7_E415_F148_84D0 = 0x8701_55C8_0CCA_DD32_6AB7_E415_F148_84D0
38+
39+
#: 0x00B5 A69C 795D F5D5 F008 7F56 843F 2C40 [:rfc:`9374`]
40+
Tag_00B5_A69C_795D_F5D5_F008_7F56_843F_2C40 = 0x00B5_A69C_795D_F5D5_F008_7F56_843F_2C40
41+
42+
@staticmethod
43+
def get(key: 'int | str', default: 'int' = -1) -> 'CGAType':
44+
"""Backport support for original codes.
45+
46+
Args:
47+
key: Key to get enum item.
48+
default: Default value if not found.
49+
50+
:meta private:
51+
"""
52+
if isinstance(key, int):
53+
return CGAType(key)
54+
if key not in CGAType._member_map_: # pylint: disable=no-member
55+
return extend_enum(CGAType, key, default)
56+
return CGAType[key] # type: ignore[misc]
57+
58+
@classmethod
59+
def _missing_(cls, value: 'int') -> 'CGAType':
60+
"""Lookup function used when value is not found.
61+
62+
Args:
63+
value: Value to get enum item.
64+
65+
"""
66+
if not (isinstance(value, int) and 0 <= value <= 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF):
67+
raise ValueError('%r is not a valid %s' % (value, cls.__name__))
68+
return extend_enum(cls, 'Tag_%s' % ('_'.join(__import__('textwrap').wrap('%032x' % value, 4))), value)

pcapkit/vendor/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@
9090
'MH_UpdateNotificationReason', 'MH_UpdateNotificationACKStatus',
9191
'MH_FlowBindingType', 'MH_FlowBindingIndicationTrigger',
9292
'MH_FlowBindingACKStatus', 'MH_FlowBindingAction', 'MH_QoSAttribute',
93-
'MH_LMAControlledMAGSuboption', 'MH_LLACode',
93+
'MH_LMAControlledMAGSuboption', 'MH_LLACode', 'MH_CGAType',
94+
'MH_CGAExtension', 'MH_CGASec',
9495
# OSPF
9596
'OSPF_Authentication', 'OSPF_Packet',
9697
# TCP

0 commit comments

Comments
 (0)