コード例 #1
0
ファイル: xpress.py プロジェクト: named-data/ndn-lighting
        def sendSignedInterest(self,command):
                self.count = self.count +1
                time.sleep(self.cfg.refreshInterval)
                fullURI = self.cfg.appPrefix + command
                print fullURI
                i = Interest.Interest()
                #self.state = NameCrypto.new_state()
                #build keyLocator to append to interest for NameCrypto on upcall
                keyLoc = Key.KeyLocator(self.key)
                keyLocStr = _pyccn.dump_charbuf(keyLoc.ccn_data)
                nameAndKeyLoc = Name.Name(str(fullURI))
                #print("there are "+str(len(nameAndKeyLoc))+" components")
                nameAndKeyLoc += keyLocStr
                #print("there are "+str(len(nameAndKeyLoc))+" components after adding keyLocStr")

                #symmetric
                authName = NameCrypto.authenticate_command(self.state, nameAndKeyLoc, self.cfg.appName, self.cryptoKey)

                #asymmetric
                #authName = NameCrypto.authenticate_command_sig(self.state, nameAndKeyLoc, self.cfg.appName, self.key)

                #print authName.components


                co = self.handle.expressInterest(authName,self)
コード例 #2
0
ファイル: transmitter_repo.py プロジェクト: remap/ndnvideo
    def put(self, content):
        name = str(self._sequence)
        self._sequence += 1

        of = open(os.path.join(self.import_loc, name), "wb")
        of.write(_pyccn.dump_charbuf(content.ccn_data))
        of.close()

        self.handle.expressInterest(pyccn.Name(self.name + name), self, self.interest_tpl)
コード例 #3
0
    def put(self, content):
        name = str(self._sequence)
        self._sequence += 1

        of = open(os.path.join(self.import_loc, name), "wb")
        of.write(_pyccn.dump_charbuf(content.ccn_data))
        of.close()

        self.handle.expressInterest(pyccn.Name(self.name + name), self,
                                    self.interest_tpl)
コード例 #4
0
ファイル: rainbow.py プロジェクト: named-data/ndn-lighting
	def sendSignedInterest(self,command):
		fullURI = self.cfg.appPrefix + command
		print fullURI
		i = Interest.Interest()
		
		#build keyLocator to append to interest for NameCrypto on upcall
		keyLoc = Key.KeyLocator(self.key)
		keyLocStr = _pyccn.dump_charbuf(keyLoc.ccn_data)
		nameAndKeyLoc = Name.Name(str(fullURI))
		#print("there are "+str(len(nameAndKeyLoc))+" components")
		nameAndKeyLoc += keyLocStr
		#print("there are "+str(len(nameAndKeyLoc))+" components after adding keyLocStr")
		authName = NameCrypto.authenticate_command(self.state, nameAndKeyLoc, self.cfg.appName, self.cryptoKey)
		#print authName.components
		
		co = self.handle.get(authName,i,500)
		if not not co: 
			#if co is not empty,  print result for debugging
			print("interest "+str(co.content))
コード例 #5
0
ファイル: faderboard.py プロジェクト: named-data/ndn-lighting
	def sendSignedInterest(self,command):
		fullURI = self.cfg.appPrefix + command
		#print fullURI
		i = Interest()
		
		#build keyLocator to append to interest for NameCrypto on upcall
		keyLoc = pyccn.KeyLocator(self.key)
		keyLocStr = _pyccn.dump_charbuf(keyLoc.ccn_data)
		nameAndKeyLoc = Name(str(fullURI))
		#print("there are "+str(len(nameAndKeyLoc))+" components")
		nameAndKeyLoc += keyLocStr
		#print("there are "+str(len(nameAndKeyLoc))+" components after adding keyLocStr")
		
		t0 = time()
		authName = NameCrypto.authenticate_command(self.state, nameAndKeyLoc, self.cfg.appName, self.cryptoKey)
		t1 = time()
		
		#print "elapsed sign", t1-t0
		#print authName.components
		
		t0 = time()
		co = self.handle.expressInterest(authName,self)
		t1 = time()
コード例 #6
0
ファイル: utils.py プロジェクト: enzocxt/AccessControl
	def put(self, content):
		self.sock.send(_pyccn.dump_charbuf(content.ccn_data))
		self.handle.put(content)
コード例 #7
0
 def put(self, content):
     self.sock.send(_pyccn.dump_charbuf(content.ccn_data))