/** * record the capabilites passed in from the peer * * @param packet */ void recordPeerCapabilities(OpenPacket packet) { remoteCapabilities.clear(); if (packet.getCapabilities() != null) { remoteCapabilities.addAll(packet.getCapabilities()); } }
/** * Insert the currently negotiated capabilities into the OPEN packet. * * <p>If the capabilities contain an AS number larger than 65536 then the AS number in the OPEN * packet is changed to AS_TRANS (23456) * * @param packet * @param capabilities * @see BGPv4Constants#BGP_AS_TRANS */ private void insertLocalCapabilities(OpenPacket packet, Collection<Capability> capabilities) { for (Capability cap : capabilities) { if (cap instanceof AutonomousSystem4Capability) { AutonomousSystem4Capability as4cap = (AutonomousSystem4Capability) cap; if (as4cap.getAutonomousSystem() > 65536) { packet.setAutonomousSystem(BGPv4Constants.BGP_AS_TRANS); } } packet.getCapabilities().add(cap); } }
/** * Insert the currently negotiated capabilities into the OPEN packet. * * <p>If the capabilities contain an AS number larger than 65536 then the AS number in the OPEN * packet is changed to AS_TRANS (23456) * * @param packet * @see BGPv4Constants#BGP_AS_TRANS */ void insertLocalCapabilities(OpenPacket packet) { packet.getCapabilities().clear(); insertLocalCapabilities(packet, peerConfiguration.getCapabilities().getRequiredCapabilities()); insertLocalCapabilities(packet, peerConfiguration.getCapabilities().getOptionalCapabilities()); }