def Announce(pfx, mux): print "Prefix Used for annoucement " + str(pfx) #p = Process(target=ctrlpfx_new.announce, args=(int(pfx), mux)) #p.start() str1 = mux.split(".") if len(str1) == 2: asn = str1[1].split("/") mux = str1[0] poison = "" for i in range(len(asn)): poison = poison + asn[i] + " " if len(asn) == 1: if poison.strip() == "withdraw": ctrlpfx.withdraw(pfx, mux) #pfx,MUX elif poison.strip() == "unpoison": ctrlpfx.unpoison(pfx, mux) else: poison = poison + "47065" print "poisoning " + poison print "Mux" + mux ctrlpfx.poison(pfx, mux, poison) else: poison = poison + "47065" print "poisoning " + poison print "Mux " + mux + "," ctrlpfx.poison(pfx, mux, poison) else: ctrlpfx.announce(pfx, mux) print "Announing " + mux
def Announce(pfx,mux): print "Prefix Used for annoucement "+str(pfx) #p = Process(target=ctrlpfx_new.announce, args=(int(pfx), mux)) #p.start() str1=mux.split(".") if len(str1)==2: asn=str1[1].split("/") mux=str1[0]; poison=""; for i in range(len(asn)): poison=poison+asn[i]+" " if len(asn) == 1: if poison.strip() == "withdraw": ctrlpfx.withdraw(pfx,mux) #pfx,MUX elif poison.strip() == "unpoison": ctrlpfx.unpoison(pfx,mux) else: poison=poison+"47065" print "poisoning " +poison print "Mux" + mux ctrlpfx.poison(pfx,mux,poison) else: poison=poison+"47065" print "poisoning " +poison print "Mux " + mux +"," ctrlpfx.poison(pfx,mux,poison) else: ctrlpfx.announce(pfx,mux) print "Announing "+mux
if email is not None: sendEmail(email, pfx, msg[1]) else: print "No Email found in DB" else: print "No prefixes avaialble for advertisement" print "Request is queued" #Add to queue <Operation,MUX,PFX,Trans_ID> if msg[0] == 'withdraw': print 'withdrawing' muxes = msg[2].split(",") #for i in range(len(muxes)): #if muxes[i] is not None and msg[1] is not None: #p = Process(target=ctrlpfx_new.withdraw, args=(int(msg[1]),muxes[i])) #p.start() #ctrlpfx_new.withdraw(int(msg[1]),muxes[i]) #pfx,MUX if msg[1] is not None: try: updateDB_withdraw(int(msg[1])) except: print "handled" if msg[0] == 'poison': print 'Poisoning' if msg[1] is not None and msg[2] is not None: ctrlpfx.poison(int(msg[1]), msg[2]) #updateDB(int(msg[1])) clientSocket.close()
if email is not None: sendEmail(email,pfx,msg[1]) else: print "No Email found in DB" else: print "No prefixes avaialble for advertisement" print "Request is queued" #Add to queue <Operation,MUX,PFX,Trans_ID> if msg[0] == 'withdraw': print 'withdrawing' muxes=msg[2].split(",") #for i in range(len(muxes)): #if muxes[i] is not None and msg[1] is not None: #p = Process(target=ctrlpfx_new.withdraw, args=(int(msg[1]),muxes[i])) #p.start() #ctrlpfx_new.withdraw(int(msg[1]),muxes[i]) #pfx,MUX if msg[1] is not None: try: updateDB_withdraw(int(msg[1])) except: print "handled" if msg[0] == 'poison': print 'Poisoning' if msg[1] is not None and msg[2] is not None: ctrlpfx.poison(int(msg[1]),msg[2]) #updateDB(int(msg[1])) clientSocket.close()