NAME¶
pydhcplib.ipv4 - Type for IP addresses version 4
SYNOPSIS¶
from pydhcplib.type_ipv4 import ipv4
a = ipv4()
a = ipv4(string)
a = ipv4(strlist)
a = ipv4(int)
DESCRIPTION¶
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
SEE ALSO¶
pydhcp(8),
pydhcplib.hwmac(3),
pydhcplib.ipv4(3),
pydhcplib.strlist(3),
pydhcplib.DhcpPacket(3),
pydhcplib.DhcpBasicPacket(3),
pydhcplib.DhcpNetwork(3), pydhcplib.DhcpClient(3), pydhcplib.DhcpRawClient(3),
pydhcplib.DhcpDerver(3)
BUGS¶
See
http://pydhcplib.tuxfamily.org/ for more information.
AUTHOR¶
Mathieu Ignacio (mignacio[AT]april.org)