def _create_hdrs(self): """ Create headers for a SCION packet """ dest = SCIONAddr.from_values(self.remote, SVCType.SB_A) cmn_hdr, addr_hdr = build_base_hdrs(self.addr, dest) payload = SIBRAPayload.from_values() udp_hdr = SCIONUDPHeader.from_values(self.addr, self._port, dest, 0) return cmn_hdr, addr_hdr, udp_hdr, payload
def _create_reg_pkt(self, type_, remote=False): if remote: dst_ia = self.remote path = self.seg.get_path(True) else: dst_ia = self.addr.isd_as path = SCIONPath() pcb = self._create_reg_pcb(remote) pld = PathRecordsReg.from_values({type_: [pcb]}) dest = SCIONAddr.from_values(dst_ia, SVCType.PS_A) cmn_hdr, addr_hdr = build_base_hdrs(self.addr, dest) udp_hdr = SCIONUDPHeader.from_values(self.addr, self._port, dest, 0) return SCIONL4Packet.from_values(cmn_hdr, addr_hdr, path, [], udp_hdr, pld)
def _build_packet(self, dst_host=None, path=None, ext_hdrs=(), dst_ia=None, payload=None, dst_port=0): if dst_host is None: dst_host = HostAddrNone() if dst_ia is None: dst_ia = self.addr.isd_as if path is None: path = SCIONPath() if payload is None: payload = PayloadRaw() dst_addr = SCIONAddr.from_values(dst_ia, dst_host) cmn_hdr, addr_hdr = build_base_hdrs(dst_addr, self.addr) udp_hdr = SCIONUDPHeader.from_values( self.addr, self._port, dst_addr, dst_port) return SCIONL4Packet.from_values( cmn_hdr, addr_hdr, path, ext_hdrs, udp_hdr, payload)
def _create_l4_hdr(self): return SCIONUDPHeader.from_values(self.addr, self.sock.port, self.dst, self.dport)