packet lib: pydoc update/improvements after api change

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
YAMAMOTO Takashi 2013-08-01 13:55:01 +09:00 committed by FUJITA Tomonori
parent d29b3b3d7a
commit 4f74c9b367
4 changed files with 43 additions and 35 deletions

View File

@ -33,21 +33,23 @@ class arp(packet_base.PacketBase):
An instance has the following attributes at least.
Most of them are same to the on-wire counterparts but in host byte order.
IPv4 addresses are represented as a string like '192.0.2.1'.
MAC addresses are represented as a string like '08:60:6e:7f:74:e7'.
__init__ takes the correspondig args in this order.
============== ====================
Attribute Description
============== ====================
============== ==================== =====================
Attribute Description Example
============== ==================== =====================
hwtype ar$hrd
proto ar$pro
hlen ar$hln
plen ar$pln
opcode ar$op
src_mac ar$sha
src_ip ar$spa
dst_mac ar$tha
dst_ip ar$tpa
============== ====================
src_mac ar$sha '08:60:6e:7f:74:e7'
src_ip ar$spa '192.0.2.1'
dst_mac ar$tha '00:00:00:00:00:00'
dst_ip ar$tpa '192.0.2.2'
============== ==================== =====================
"""
_PACK_STR = '!HHBBH6s4s6s4s'

View File

@ -25,15 +25,16 @@ class ethernet(packet_base.PacketBase):
"""Ethernet header encoder/decoder class.
An instance has the following attributes at least.
MAC addresses are represented as a string like '08:60:6e:7f:74:e7'.
__init__ takes the correspondig args in this order.
=========== ====================
Attribute Description
=========== ====================
dst destination address
src source address
ethertype ether type
=========== ====================
============== ==================== =====================
Attribute Description Example
============== ==================== =====================
dst destination address 'ff:ff:ff:ff:ff:ff'
src source address '08:60:6e:7f:74:e7'
ethertype ether type 0x0800
============== ==================== =====================
"""
_PACK_STR = '!6s6sH'

View File

@ -38,28 +38,31 @@ class ipv4(packet_base.PacketBase):
An instance has the following attributes at least.
Most of them are same to the on-wire counterparts but in host byte order.
IPv4 addresses are represented as a string like '192.0.2.1'.
__init__ takes the correspondig args in this order.
============== ====================
Attribute Description
============== ====================
============== ======================================== ==================
Attribute Description Example
============== ======================================== ==================
version Version
header_length IHL
tos Type of Service
total_length Total Length \
(0 means automatically-calculate when encoding)
total_length Total Length
(0 means automatically-calculate
when encoding)
identification Identification
flags Flags
offset Fragment Offset
ttl Time to Live
proto Protocol
csum Header Checksum \
(Ignored and automatically-calculated when encoding)
src Source Address
dst Destination Address
option A bytearray which contains the entire Options, or None for \
no Options
============== ====================
csum Header Checksum
(Ignored and automatically-calculated
when encoding)
src Source Address '192.0.2.1'
dst Destination Address '192.0.2.2'
option A bytearray which contains the entire
Options, or None for no Options
============== ======================================== ==================
"""
_PACK_STR = '!BBHHHBBH4s4s'

View File

@ -33,21 +33,23 @@ class ipv6(packet_base.PacketBase):
An instance has the following attributes at least.
Most of them are same to the on-wire counterparts but in host byte order.
IPv6 addresses are represented as a string like 'ff02::1'.
__init__ takes the correspondig args in this order.
============== ====================
Attribute Description
============== ====================
============== ======================================== ==================
Attribute Description Example
============== ======================================== ==================
version Version
traffic_class Traffic Class
flow_label When decoding, Flow Label. \
When encoding, the most significant 8 bits of Flow Label.
flow_label When decoding, Flow Label.
When encoding, the most significant 8
bits of Flow Label.
payload_length Payload Length
nxt Next Header
hop_limit Hop Limit
src Source Address
dst Destination Address
============== ====================
src Source Address 'ff02::1'
dst Destination Address '::'
============== ======================================== ==================
"""
_PACK_STR = '!IHBB16s16s'