Exemple #1
0
    def __init__(self, **kwargs):
        super(Host, self).__init__(n_interfaces=1)
        self.libsocket = LibSocket(self)

        ip = kwargs.get('ip', '192.168.0.1{:02}'.format(self.index))
        mask = kwargs.get('mask', '255.255.255.0')
        mac = kwargs.get('mac', None)

        self.interfaces = [
            Interface(self, nic, ip, mask, mac) for nic in self.nics
        ]
        self.interface = self.interfaces[0]
        self.interface.report.connect(self.report)
        self.interface.on_ipv4.connect(self.on_ipv4)

        self.routes = RouteTable(self)
Exemple #2
0
    def __init__(self, **kwargs):
        super(Host, self).__init__(n_interfaces=1)
        self.libsocket = LibSocket(self)
        self.sockets = {
            Packet.Protocol.TCP: {},
            Packet.Protocol.UDP: {},
        }

        ip = kwargs.get('ip', None)
        mac = kwargs.get('mac', None)

        self.interfaces = [Interface(self, nic, ip, mac) for nic in self.nics]
        self.interface = self.interfaces[0]
        self.interface.on_ipv4.connect(self.on_ipv4)
        self.interface.report.connect(self.report)

        self.routes = RouteTable(self)

        self.dhcp_client = DHCPClient(self)
Exemple #3
0
 def __init__(self, n_interfaces=3):
     super(Router, self).__init__(n_interfaces)
     self.interfaces = [Interface(self, nic) for nic in self.nics]
     each(self.interfaces).report.connect(self.report)
     each(self.interfaces).on_ipv4.connect(self.on_ipv4)
     self.routes = RouteTable()