Пример #1
0
    def run(self):
        #inicializar pit, fib e cs
        if not self.data_ids.keys():
            

        #criar socket server tcp

        # Receiving NDN Messages
        while True:
            rcv_msg = self.sock.recvfrom(10240)

            ndn_handler = Receive_Handler(
                                        self.lock, self.pit, self.fib,
                                        self.cs, self.conn, self.queue, self.localhost,
                                        self.udp_port

                )
            ndn_handler.start()

        # Send NDN HELLO messages
        ndn_hello_sender = NDN_HelloSender(
                                    self.fib, self.lock,self.localhost,
                                    self.hello_interval, self.cs,
                                    self.mcast_group, self.mcast_port
                                )
        ndn_hello_sender.start()
Пример #2
0
    def run(self):
        #inicializar pit, fib e cs
        if self.data_ids:
            for ids in data_idsself.fib[]

        #criar socket server tcp
            tcp_socket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
            tcp_socket.bind((self.localhost, self.port))

        # Receiving NDN Messages
            while True:
                rcv_msg = self.sock.recvfrom(10240)

                ndn_handler = Receive_Handler(
                                            self.lock, self.pit, self.fib,
                                            self.cs, self.conn, self.queue, self.localhost,
                                            self.udp_port

                    )
                ndn_handler.start()

            # Send NDN HELLO messages
            ndn_hello_sender = NDN_HelloSender(
                                        self.fib, self.lock,self.localhost,
                                        self.hello_interval, self.cs,
                                        self.mcast_group, self.mcast_port
                                    )
            ndn_hello_sender.start()

        else:
            print('data_ids is empty')
Пример #3
0
    def run(self):
        #TCP Server
        tcp_socket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
        tcp_socket.bind((self.localhost, self.port))
        tcp_socket.listen()

        ndn_hello_sender = NDN_HelloSender(
                                    self.lock, self.hello_interval, 
                                    self.cs, self.fib, self.localhost,
                                    'multicast', self.port
                                )

        ndn_hello_sender.start()

        # Receiving NDN Messages
        while True:
            self.conn, _ = tcp_socket.accept()

            ndn_handler = Receive_Handler(
                                        self.lock, self.pit, self.fib,
                                        self.cs, self.conn, self.localhost
                )

            ndn_handler.start()
            
            
            print('########## CS #########')
            print(dumps(self.cs, indent=2))
            print('\n########## FIB #########')
            print(dumps(self.fib, indent=2))
            print()
Пример #4
0
    def run(self):
        # Check whether we have data in data_ids to add them to cs
        """
        data_ids = {
            'N104.continente': '',
            'N101.A3' : '',
            'N14.braga_parque': '',
            'N4.celerois' : ''
        }

        self.fib = {
            'N104.continente': {
                'Name': 'N104.continente'
                'interfaces' : ['source1','source2']
                },
            'N14.A3': {
                'Name': 'N14.A3'
                'interfaces' : ['source1']
                }
            }

        self.cs = {
            'N104.continente': 'acidente',
            'N101.A3' : ''
        }

        self.pit = {
            'N104.continente.acidente': [$requester1, $requester2],
            'N101.pingodoce.trabalhos': [$requester]
        }

        """
        if self.data_ids:
            for key, value in data_ids.items():
                self.cs[key] = value

        #TCP Server
        tcp_socket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
        tcp_socket.bind((self.localhost, self.port))
        tcp_socket.listen()

        # Receiving NDN Messages
        while True:
            self.conn, _ = self.socket.accept()
            rcv_msg = self.sock.recvfrom(10240)

            ndn_handler = Receive_Handler(self.lock, self.pit, self.fib,
                                          self.cs, self.conn, self.queue,
                                          self.localhost, self.udp_port)

            ndn_handler.start()

        # Send NDN HELLO messages
        ndn_hello_sender = NDN_HelloSender(self.fib, self.lock, self.localhost,
                                           self.hello_interval, self.cs,
                                           self.mcast_addr, self.port)
        ndn_hello_sender.start()
Пример #5
0
    def run(self):
        #inicializar pit, fib e cs
        """
        data_ids = {
            'N104.continente': '',
            'N101.A3' : '',
            'N14.braga_parque': '',
            'N4.celerois' : ''
        }

        self.fib = {
            '104.continente' : ['source1','source2'],
            '101.A3' : ['source1','source2']
        }

        self.cs = {
            '104.continente': 'acidente',
            '101.A3' : ''
        }

        self.pit = {

        }
        """
        self.cs = {}
        self.fib = {}
        self.
        if self.data_ids:
            for key,value in data_ids.items():
                self.cs[key] = value
                #self.fib[key]
                self.pit = {}

        #criar socket server tcp
        tcp_socket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
        tcp_socket.bind((self.localhost, self.port))

    # Receiving NDN Messages
        while True:
            rcv_msg = self.sock.recvfrom(10240)

            ndn_handler = Receive_Handler(
                                        self.lock, self.pit, self.fib,
                                        self.cs, self.conn, self.queue, self.localhost,
                                        self.udp_port

                )
                
            ndn_handler.start()

        # Send NDN HELLO messages
        ndn_hello_sender = NDN_HelloSender(
                                    self.fib, self.lock,self.localhost,
                                    self.hello_interval, self.cs,
                                    self.mcast_group, self.mcast_port
                                )
        ndn_hello_sender.start()
Пример #6
0
    def run(self):
        #inicializar pit, fib e cs

        self.data_ids = {
            'N104.continente': '',
            '101.A3' : '',
            '10.continente': '',
            '101.A3' : ''
        }

        self.fib = {
            '104.continente' : self.msg['source'],
            '101.A3' : self.msg['source']
        }

        self.cs = {
            '104.continente': '',
            '101.A3' : ''
        }

        self.pit = {

        }

        if self.data_ids:
            for key,value in data_ids.items():
                self.fib[key] = value
                self.cs[key]

        #criar socket server tcp
            tcp_socket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
            tcp_socket.bind((self.localhost, self.port))

        # Receiving NDN Messages
            while True:
                rcv_msg = self.sock.recvfrom(10240)

                ndn_handler = Receive_Handler(
                                            self.lock, self.pit, self.fib,
                                            self.cs, self.conn, self.queue, self.localhost,
                                            self.udp_port

                    )
                ndn_handler.start()

            # Send NDN HELLO messages
            ndn_hello_sender = NDN_HelloSender(
                                        self.fib, self.lock,self.localhost,
                                        self.hello_interval, self.cs,
                                        self.mcast_group, self.mcast_port
                                    )
            ndn_hello_sender.start()

        else:
            print('data_ids is empty')
Пример #7
0
    def run(self):
        #inicializar pit, fib e cs
        #if
        #criar socket server tcp

        while True:
            rcv_msg = self.sock.recvfrom(10240)

            ndn_handler = Receive_Handler(self.lock, self.pit, self.fib,
                                          self.cs, self.conn, self.queue,
                                          self.localhost, self.udp_port)
            ndn_handler.start()

        # Send HELLO NDN messages
        hello_sender = NDN_HelloSender(self.fib, self.lock,
                                       self.hello_interval, self.local_ip,
                                       self.mcast_ttl, self.mcast_group,
                                       self.mcast_port)
        hello_sender.start()