PGEN-Packet

PGEN-Packet has packet-class, analyzing protocols.  pgen_packet class is basic packet class that is generaly class,  having pure virtual functions. Theare are many class being inheritance pgen_packet.  It can analyze protocols. For example, pgen_arp class analyze ARP packet, pgen_tcp class analyze TCP packet.  They connect each other while protocols inheritance. pgen_arp class is inheritance pgen_eth class.  pgen_tcp class is inheritance pgen_ip class. libpgen is support Ethernet, ARP, IP, ICMP, TCP, UDP at default(30/Nov/2015).

PGEN support Ethernet, ARP, IP, ICMP, TCP and UDP at default. Users can extend protocols easily.

Inheritance Relationship of Packet Class

PGEN-Packet’s Member Functions

NAME

send, send_dev    send packet
cast                                  analyze packet
clear                               restore values of protocol, default
hex, info, summary, help  print information
byte,
length                  get binary information

SYNOPSIS

 

DESCRIPTION

send_dev() sends packet to L2 network interface.
interface, 1st argument is interface name.

send() sends packet with PGEN desctipter,
handle, 1st argument is PGEN descriptor opened pgen_open()

hex() prints packet binary’s hexdump. calling compile() inside this function.

length() gets packet length. calling compile() inside this function.
This function returns int, packet length.

byte() gets packet binary’s pointer. calling compile() inside this function.
This function returns u_char*, pointer of packet’s binary.

clear() restore protocol’s value to default.

help() prints usage of class.

info() prints all information values of protocol

summary() prints summary about packet 1 line.

cast() analyze packet binary and reflection to member value.
buf, 1st argment is pointer of buffer.
len, 2nd argment is length of buffer.

Protocols

PGEN-Packet can analyze many protocol’s packet powerful. There are many class inheriting pgen_packet class.

PGEN-Unknow is specific packet class. It can analyze packets, at rough.

 

 

Sample Code

This is sample program that send ARP packet.

 

How to Extend New Protocol

write soon….

We are writing a document of PGEN-Packet. if you need more information, please see libpgen on GitHub.

Comments are closed.