pydhcplib.strlist(3) Internal type of pydhcplib for lists of bytes processing.

SYNOPSIS

from pydhcplib.type_hw_addr import hwmac

a = strlist()
a = strlist([100,100,10,42,44,26])

DESCRIPTION

The class pydhcplib.strlist is an specific type of pydhcplib. It exist in order to simplify processing of raw data from network. When a dhcp packet dhcp is received, it's a succession of approximately 300 bytes. Within pydhcplib these data are transformed in an intermediary form of type "strlist" in order to facilitate their handling. This intermediary form will eventually be suppressed in the stable versions of pydhcplib to speedup the processing time, but backward compatibility will be assured.

The pydhcplib.strlist class creation argument can be a list of numbers whose value goes from 0?55.

The pydhcplib.strlist class creation argument can be a string of ASCII character.

METHODS

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

else :

str() convert the address into a printable string type.

list() convert the address into a list of bytes.

EXAMPLES

Example program strlist_example.py :

from pydhcplib.type_strlist import strlist

word = strlist()
word1 = strlist("azerty")
word2 = strlist("qwerty")
word3 = strlist([97, 122, 101, 114, 116, 121])

print "a0 : ",word
print "a1 : ",word1
print "a2 : ",word2
print "a3 : ",word3

if word1 == word2 :
       print "test 1 : ",word1, "==",word2

else :
       print "test 1 : " ,word1, "!=",word2

if word1 == word3 :
       print "test 2 : ", word1, "==",word3

else :
       print "test 2 : ", word1, "!=",word3

BUGS

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

AUTHOR

Mathieu Ignacio (mignacio[AT]april.org)