summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>2013-08-01 13:55:01 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2013-08-01 14:25:56 +0900
commit4f74c9b367ee47529807d1153dd03eaedfd8fb35 (patch)
tree97abcf2064e60681df91213f05bdab0df72b7af4
parentd29b3b3d7a77c29cfe5ffd440fe2bb612caf4e30 (diff)
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>
-rw-r--r--ryu/lib/packet/arp.py18
-rw-r--r--ryu/lib/packet/ethernet.py15
-rw-r--r--ryu/lib/packet/ipv4.py27
-rw-r--r--ryu/lib/packet/ipv6.py18
4 files changed, 43 insertions, 35 deletions
diff --git a/ryu/lib/packet/arp.py b/ryu/lib/packet/arp.py
index 2edb0282..191ce9a9 100644
--- a/ryu/lib/packet/arp.py
+++ b/ryu/lib/packet/arp.py
@@ -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'
diff --git a/ryu/lib/packet/ethernet.py b/ryu/lib/packet/ethernet.py
index 0ca77d8b..2b8c932d 100644
--- a/ryu/lib/packet/ethernet.py
+++ b/ryu/lib/packet/ethernet.py
@@ -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'
diff --git a/ryu/lib/packet/ipv4.py b/ryu/lib/packet/ipv4.py
index d80c8497..8a07c815 100644
--- a/ryu/lib/packet/ipv4.py
+++ b/ryu/lib/packet/ipv4.py
@@ -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'
diff --git a/ryu/lib/packet/ipv6.py b/ryu/lib/packet/ipv6.py
index f2393ef7..b65b8234 100644
--- a/ryu/lib/packet/ipv6.py
+++ b/ryu/lib/packet/ipv6.py
@@ -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'