L2TP - Layer Two Tunnelling Protocol¶
pcapkit.protocols.link.l2tp contains
L2TP only,
which implements extractor for Layer Two Tunnelling
Protocol (L2TP) *, whose structure is described
as below:
Octets |
Bits |
Name |
Description |
|---|---|---|---|
0 |
0 |
|
Flags and Version Info |
0 |
0 |
|
Type (control / data) |
0 |
1 |
|
Length |
0 |
2 |
Reserved (must be zero |
|
0 |
4 |
|
Sequence |
0 |
5 |
Reserved (must be zero |
|
0 |
6 |
|
Offset |
0 |
7 |
|
Priority |
1 |
8 |
Reserved (must be zero |
|
1 |
12 |
|
Version ( |
2 |
16 |
|
Length (optional by |
4 |
32 |
|
Tunnel ID |
6 |
48 |
|
Session ID |
8 |
64 |
|
Sequence Number (optional by |
10 |
80 |
|
Next Sequence Number (optional by |
12 |
96 |
|
Offset Size (optional by |
-
class
pcapkit.protocols.link.l2tp.L2TP(file=None, length=None, **kwargs)[source]¶ Bases:
pcapkit.protocols.link.link.LinkThis class implements Layer Two Tunnelling Protocol.
-
classmethod
__index__()[source]¶ Numeral registry index of the protocol.
- Raises
UnsupportedCall – This protocol has no registry entry.
-
make(**kwargs)[source]¶ Make (construct) packet data.
- Keyword Arguments
**kwargs – Arbitrary keyword arguments.
- Returns
Constructed packet data.
- Return type
-
read(length=None, **kwargs)[source]¶ Read Layer Two Tunnelling Protocol.
Structure of L2TP header [RFC 2661]:
0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |T|L|x|x|S|x|O|P|x|x|x|x| Ver | Length (opt) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Tunnel ID | Session ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Ns (opt) | Nr (opt) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Offset Size (opt) | Offset pad... (opt) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
length (Optional[int]) – Length of packet data.
- Keyword Arguments
**kwargs – Arbitrary keyword arguments.
- Returns
Parsed packet data.
- Return type
-
property
name¶ Name of current protocol.
- Return type
Literal[‘Layer 2 Tunnelling Protocol’]
-
property
type¶ L2TP type.
- Return type
Literal[‘Control’, ‘Data’]
-
classmethod
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit module.
-
class
pcapkit.protocols.link.l2tp.DataType_L2TP¶ - Bases
TypedDict
L2TP header.
-
flags: DataTYpe_Flags¶ flags & versoion info
-
version: Literal[2]¶ version (
2)
-
class
pcapkit.protocols.link.l2tp.DataType_Flags¶ - Bases
TypedDict
Flags and version info.
-
type: Literal[‘Control’, ‘Data’]¶ type (control / data)