async def main(self): # Create (local) multicast group endpoint mcg = taps.LocalEndpoint() mcg.with_address(args.group_address) mcg.with_port(args.group_port) # Create (remote) source endpoint ssm = taps.RemoteEndpoint() ssm.with_address(args.ssm_address) ssm.with_port(args.ssm_port) # Create endpoint for the remote for AMBI rambi = taps.RemoteEndpoint() rambi.with_address(args.remote_ambi_address) rambi.with_port(args.remote_ambi_port) # Create endpoint for the local for AMBI if args.local_ambi_address is not None: lambi = taps.LocalEndpoint() lambi.with_address(args.local_ambi_address) lambi.with_port(args.local_ambi_port) else: lambi = None # Set the transportpropterties necessary to get a multicast stream tp = taps.TransportProperties() tp.add("direction", "unidirection-receive") tp.prohibit("reliability") tp.ignore("congestion-control") tp.ignore("preserve-order") # Configure the preconnection self.preconnection = taps.Preconnection(remote_endpoint=ssm, local_endpoint=mcg, transport_properties=tp) # Set the new connection callback self.preconnection.on_connection_received( self.handle_connection_received) # Create a new AMBI framer object and set it on the preconnection. ambi = AmbiFramer(remote_endpoint=rambi, local_endpoint=lambi) self.preconnection.add_framer(ambi) # Initiate the preconnection so it can start to received multicast packets self.listener = await self.preconnection.listen()
async def main(self, args): # Create endpoint objects ep = taps.RemoteEndpoint() if args.remote_address: ep.with_address(args.remote_address) elif args.remote_host: ep.with_hostname(args.remote_host) if args.remote_port: ep.with_port(args.remote_port) lp = None sp = None if args.interface or args.local_address or args.local_port: lp = taps.LocalEndpoint() if args.interface: lp.with_interface(args.interface) if args.local_address: lp.with_port(args.local_address) if args.local_port: lp.with_port(args.local_port) logger.info("Created endpoint objects.") if args.secure or args.trust_ca or args.local_identity: # Use TLS sp = taps.SecurityParameters() if args.trust_ca: sp.add_trust_ca(args.trust_ca) if args.local_identity: sp.add_identity(args.local_identity) logger.info("Created SecurityParameters.") # Create transportProperties Object and set properties # Does nothing yet tp = taps.TransportProperties() # tp.prohibit("reliability") tp.ignore("congestion-control") tp.ignore("preserve-order") # tp.add("Reliable_Data_Transfer", taps.preferenceLevel.REQUIRE) # Create the preconnection object with the two prev created EPs self.preconnection = taps.Preconnection(remote_endpoint=ep, local_endpoint=lp, transport_properties=tp, security_parameters=sp) # Set callbacks self.preconnection.on_initiate_error(self.handle_initiate_error) self.preconnection.on_ready(self.handle_ready) # Set the framer framer = TestFramer() self.preconnection.add_framer(framer) logger.info("Created preconnection object and set cbs.") # Initiate the connection self.connection = await self.preconnection.initiate() # msgref = await self.connection.send_message("Hello\n") logger.info("Called initiate, connection object created.")
async def main(self): lp = taps.LocalEndpoint() lp.with_hostname("localhost") lp.with_port(6666) tp = taps.TransportProperties() tp.prohibit("reliability") tp.ignore("congestion-control") tp.ignore("preserve-order") self.preconnection = taps.Preconnection(local_endpoint=lp, transport_properties=tp) self.preconnection.on_connection_received( self.handle_connection_received) await self.preconnection.listen()
async def main(self, args): # Create endpoint object lp = taps.LocalEndpoint() if args.interface: lp.with_interface(args.interface) if args.local_address: lp.with_address(args.local_address) if args.local_host: lp.with_hostname(args.local_host) # If nothing to listen on has been specified, listen on localhost if not args.interface and not args.local_address\ and not args.local_host: lp.with_hostname("localhost") if args.local_port: lp.with_port(args.local_port) taps.print_time("Created endpoint objects.", color) sp = None if args.secure or args.trust_ca or args.local_identity: # Use TLS sp = taps.SecurityParameters() if args.trust_ca: sp.addTrustCA(args.trust_ca) if args.local_identity: sp.addIdentity(args.local_identity) taps.print_time("Created SecurityParameters.", color) tp = taps.TransportProperties() tp.ignore("congestion-control") tp.ignore("preserve-order") if self.reliable == "False": tp.prohibit("reliability") if self.reliable == "Both": tp.ignore("reliability") self.preconnection = taps.Preconnection(local_endpoint=lp, transport_properties=tp, security_parameters=sp) self.preconnection.on_connection_received( self.handle_connection_received) self.preconnection.on_listen_error(self.handle_listen_error) self.preconnection.on_stopped(self.handle_stopped) # self.preconnection.frame_with(taps.TlvFramer()) await self.preconnection.listen()