예제 #1
0
 def test(self, init, raw):
     inst = HostAddrSVC("")
     pop = raw.return_value.pop
     pop.return_value = bytes.fromhex("01 0f")
     # Call
     inst._parse("raw")
     # Tests
     raw.assert_called_once_with("raw", "HostAddrSVC", inst.LEN)
     ntools.eq_(inst.addr, 0x010f)
예제 #2
0
class SVCType(object):
    """
    Defines the recognised SVC addresses.
    """
    # Beacon service
    BS = HostAddrSVC(0, raw=False)
    # Path service
    PS = HostAddrSVC(1, raw=False)
    # Certificate service
    CS = HostAddrSVC(2, raw=False)
    # SIBRA service
    SB = HostAddrSVC(3, raw=False)
예제 #3
0
 def test_with_different_ases(self):
     dst_addr = SCIONAddr.from_values(ISD_AS("1-2"),
                                      HostAddrSVC(0, raw=False))
     src_addr = SCIONAddr.from_values(ISD_AS("1-1"),
                                      HostAddrIPv4("127.0.0.1"))
     connector = self._setup_connector(svc_info_desc=("bs", "bs1"))
     # Call
     ntools.eq_(connector._resolve_dst_addr(src_addr, dst_addr), None)
     # Tests
     ntools.assert_false(connector.get_service_info.called)
예제 #4
0
class SVCType(object):
    """
    Defines the recognised SVC addresses.

    `A` suffix stands for Anycast. It indicates the packet should go to a single
    instance of that service.
    `M` suffix stands for Multicast. It indicates the packet should go to all
    instances of that service.
    """
    # Beacon service
    BS_A = HostAddrSVC(0, raw=False)
    BS_M = HostAddrSVC(0 | HostAddrSVC.MCAST, raw=False)
    # Path service
    PS_A = HostAddrSVC(1, raw=False)
    # Certificate service
    CS_A = HostAddrSVC(2, raw=False)
    # SIBRA service
    SB_A = HostAddrSVC(3, raw=False)
    # SIG service
    SIG_A = HostAddrSVC(4, raw=False)
    # No service, used e.g., in TCP socket.
    NONE = HostAddrSVC(0xffff, raw=False)
예제 #5
0
 def _build_pkt(self):
     pkt = super()._build_pkt()
     pkt.set_payload(IFIDPayload.from_values(77))
     pkt.addrs.dst.host = HostAddrSVC(99, raw=False)
     return pkt