Link Layer Protocols¶

pcapkit.protocols.link is collection of all protocols in link layer, with detailed implementation and methods.

  • ARP/InARP - (Inverse) Address Resolution Protocol
    • Data Structure
  • Ethernet Protocol
    • Data Structure
  • L2TP - Layer Two Tunnelling Protocol
    • Data Structure
  • OSPF - Open Shortest Path First
    • Data Structure
      • Cryptographic Authentication Information
  • RARP/DRARP - (Dynamic) Reverse Address Resolution Protocol
  • VLAN - 802.1Q Customer VLAN Tag Type
    • Data Structure

Base Protocol¶

pcapkit.protocols.link.link contains Link, which is a base class for link layer protocols, e.g. ARP/InARP, Ethernet, L2TP, OSPF, RARP/DRARP and etc.

class pcapkit.protocols.link.link.Link(file=None, length=None, **kwargs)[source]¶

Bases: pcapkit.protocols.protocol.Protocol

Abstract base class for link layer protocol family.

__layer__ = 'Link'¶

Layer of protocol.

__proto__: DefaultDict[int, Tuple[str, str]]¶

Protocol index mapping for decoding next layer, c.f. self._decode_next_layer & self._import_next_layer. The values should be a tuple representing the module name and class name.

Code

Module

Class

0x0806

pcapkit.protocols.link.arp

ARP

0x8035

pcapkit.protocols.link.rarp

RARP

0x8100

pcapkit.protocols.link.vlan

VLAN

0x0800

pcapkit.protocols.internet.ipv4

IPv4

0x86DD

pcapkit.protocols.internet.ipv6

IPv6

0x8137

pcapkit.protocols.internet.ipx

IPX

_import_next_layer(proto, length=None)[source]¶

Import next layer extractor.

This method currently supports following protocols as registered in EtherType:

proto

Protocol

0x0806

ARP

0x8035

RARP

0x8100

VLAN

0x0800

IPv4

0x86DD

IPv6

0x8137

IPX

Parameters
  • proto (int) – next layer protocol index

  • length (int) – valid (non-padding) length

Returns

instance of next layer

Return type

pcapkit.protocols.protocol.Protocol

_read_protos(size)[source]¶

Read next layer protocol type.

Parameters

size (int) – buffer size

Returns

next layer’s protocol enumeration

Return type

pcapkit.const.reg.ethertype.EtherType

property layer¶

Protocol layer.

Return type

Literal[‘Link’]

PyPCAPKit

Navigation

  • Stream PCAP File Extractor
    • Library Foundation
    • User Interface
    • Protocol Family
    • Reassembly Packets & Datagrams
    • Core Utilities
    • Dump Utilities
    • Compatibility Tools
    • Utility Functions & Classes
    • Constant Enumerations
    • Web Crawlers for Constant Enumerations
    • Library Index
  • Command Line Interface

Related Topics

  • Documentation overview
    • Stream PCAP File Extractor
      • Protocol Family
        • Previous: Frame Header
        • Next: ARP/InARP - (Inverse) Address Resolution Protocol

Quick search

©2018-2020, Jarry Shaw. | Powered by Sphinx 3.1.1 & Alabaster 0.7.12 | Page source