Make ipv4 more handy by not asking for every args. I prefer to use more human-readble representation for src and dst but it leads to the API change so let's do it later with another patch.
Signed-off-by: FUJITA Tomonori <fujita.tomon...@lab.ntt.co.jp> --- ryu/lib/packet/ipv4.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ryu/lib/packet/ipv4.py b/ryu/lib/packet/ipv4.py index 09ed734..e2ed478 100644 --- a/ryu/lib/packet/ipv4.py +++ b/ryu/lib/packet/ipv4.py @@ -21,6 +21,7 @@ from . import icmp from . import udp from . import tcp from ryu.ofproto import inet +from ryu.lib import ip IPV4_ADDRESS_PACK_STR = '!I' @@ -64,9 +65,12 @@ class ipv4(packet_base.PacketBase): _PACK_STR = '!BBHHHBBHII' _MIN_LEN = struct.calcsize(_PACK_STR) - def __init__(self, version, header_length, tos, total_length, - identification, flags, offset, ttl, proto, csum, - src, dst, option=None): + def __init__(self, version=4, header_length=5, tos=0, + total_length=0, identification=0, flags=0, + offset=0, ttl=255, proto=0, csum=0, + src=ip.ipv4_to_bin('0.0.0.0'), + dst=ip.ipv4_to_bin('0.0.0.0'), + option=None): super(ipv4, self).__init__() self.version = version self.header_length = header_length -- 1.7.12.4 (Apple Git-37) ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT design, transition and operations 2. Dashboards that offer high-level views of enterprise services 3. A single system of record for all IT processes http://p.sf.net/sfu/servicenow-d2d-j _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel