Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 2.37 KB

PacketFactory.md

File metadata and controls

31 lines (22 loc) · 2.37 KB

Packet Factory

Packet Factory is used by the Pcap4J core module to create packet objects from captured packets (byte arrays).

Packet Factory is pluggable. This pluggability is made by the Packet Factory Binder.

Pcap4J has two Packet Factory modules, Static Packet Factory and Properties-Based Packet Factory.

Packet Factory Binder

Packet Factory Binder binds Packet Factory implementations to the Pcap4J core module. Pcap4J core module's source includes the interface of Packet Factory Binder. An implementation of Packet Factory Binder is included in a Packet Factory module which also has Packet Factory implementations.

A Packet Factory implementation is used to find a packet class (e.g. IpV4Packet) or a packet piece class (e.g. IpV4Rfc1349Tos) by a classifier (e.g. EtherType) and to instantiate its object.

Static Packet Factory

Static Packet Factory is a Packet Factory module including Packet Factory implementations which find packet and packet piece classes in static way, which means you can't replace these classes without code changes. This Packet Factory doesn't use Java reflection and so relatively faster than Properties-Based Packet Factory.

Static Packet Factory

Properties-Based Packet Factory

Properties-Based Packet Factory is a Packet Factory module including Packet Factory implementations which find packet and packet piece classes by Java properties. This Packet Factory heavily uses Java reflection and so relatively slower than Static Packet Factory.

Properties-Based Packet Factory