pydhcplib.ipv4(3)

pydhcplib.ipv43

Type for ip addresses version 4

Usage

from pydhcplib.type_ipv4 import ipv4

a = ipv4()
a = ipv4(string)
a = ipv4(strlist)
a = ipv4(int)

Overview

The class pydhcplib.ipv4 is a type "IP address version 4". It's used for string processing like "192.168.0.4".

The class creation argument can be a string like "192.168.0.4".

The class creation argument can be a list of bytes like [192,168,0,4].

Methods

The implemented methods in this class are mostly methods of comparison (= =, >, etc...)

else :

str() return data converted into a printable string.

list() return data converted into a list of bytes.

int() return data converted into an 4 bytes int.

Examples

Example program ipv4_example.py :

from pydhcplib.type_ipv4 import ipv4

address = ipv4()
address1 = ipv4("192.168.0.1")
address2 = ipv4("10.0.0.1")
address3 = ipv4([192,168,0,1])

print "a0 : ",address
print "a1 : ",address1
print "a2 : ",address2
print "a3 : ",address3

if address1 == address2 :

print "test 1 : ",address1, "==",address2
else :

print "test 1 : " ,address1, "!=",address2

if address1 == address3 :

print "test 2 : ", address1, "==",address3
else :

print "test 2 : ", address1, "!=",address3

Releases

Unchanged in 5 releases since Debian 6.0 (Squeeze).

  1. 6.0–10

Bugs

See http://pydhcplib.tuxfamily.org/ for more information.

Author

Mathieu Ignacio (mignacio[AT]april.org)

From python-pydhcplib 0.6.2-3 in Debian 10 (Buster). Parsed by carta from the page's man source.