<s> from random import random <EOL> from hashlib import md5 <EOL> from time import time <EOL> from SipGenericHF import SipGenericHF <EOL> class SipCiscoGUID ( SipGenericHF ) : <EOL> hf_names = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> ciscoGUID = None <EOL> def __init__ ( self , body = None , ciscoGUID = None ) : <EOL> SipGenericHF . __init__ ( self , body ) <EOL> if body != None : <EOL> return <EOL> self . parsed = True <EOL> if ciscoGUID != None : <EOL> self . ciscoGUID = ciscoGUID <EOL> else : <EOL> s = md5 ( str ( ( random ( ) * <NUM_LIT> L ) + time ( ) ) ) . hexdigest ( ) <EOL> self . ciscoGUID = ( long ( s [ <NUM_LIT:0> : <NUM_LIT:8> ] , <NUM_LIT:16> ) , long ( s [ <NUM_LIT:8> : <NUM_LIT:16> ] , <NUM_LIT:16> ) , long ( s [ <NUM_LIT:16> : <NUM_LIT> ] , <NUM_LIT:16> ) , long ( s [ <NUM_LIT> : <NUM_LIT:32> ] , <NUM_LIT:16> ) ) <EOL> def parse ( self ) : <EOL> self . parsed = True <EOL> self . ciscoGUID = tuple ( [ int ( x ) for x in self . body . split ( '<STR_LIT:->' , <NUM_LIT:3> ) ] ) <EOL> def __str__ ( self ) : <EOL> if not self . parsed : <EOL> return self . body <EOL> return '<STR_LIT>' % self . ciscoGUID <EOL> def getCiscoGUID ( self ) : <EOL> return self . ciscoGUID <EOL> def hexForm ( self ) : <EOL> return '<STR_LIT>' % self . ciscoGUID <EOL> def getCanName ( self , name , compact = False ) : <EOL> if name . lower ( ) == '<STR_LIT>' : <EOL> return '<STR_LIT>' <EOL> else : <EOL> return '<STR_LIT>' <EOL> def getCopy ( self ) : <EOL> if not self . parsed : <EOL> return SipCiscoGUID ( self . body ) <EOL> return SipCiscoGUID ( ciscoGUID = self . ciscoGUID ) </s>
