/** * Notification message indicating that a packet has failed to be routed to the recipient. * * @param recipient address of the entity that failed to receive the packet. * @param packet Presence packet that failed to be sent to the recipient. */ public void routingFailed( JID recipient, Packet packet ) { Log.debug( "Presence sent to unreachable address: " + packet.toXML() ); // presence packets are dropped silently } }
public Deliverable(Collection<Packet> elements) { this.text = null; this.packets = new ArrayList<>(); for (Packet packet : elements) { // Append packet namespace according XEP-0206 if needed if (Namespace.NO_NAMESPACE.equals(packet.getElement().getNamespace())) { // use string-based operation here to avoid cascading xmlns wonkery StringBuilder packetXml = new StringBuilder(packet.toXML()); final int noslash = packetXml.indexOf( ">" ); final int slash = packetXml.indexOf( "/>" ); final int insertAt = ( noslash - 1 == slash ? slash : noslash ); packetXml.insert( insertAt, " xmlns=\"jabber:client\""); this.packets.add(packetXml.toString()); } else { this.packets.add(packet.toXML()); } } }
private void deliver(Packet reply) { // Get any session of the connection manager to deliver the packet ConnectionMultiplexerSession session = multiplexerManager.getMultiplexerSession(connectionManagerDomain); if (session != null) { session.process(reply); } else { Log.warn("No multiplexer session found. Packet not delivered: " + reply.toXML()); } } }
/** * Notification message indicating that a packet has failed to be routed to the recipient. * * @param recipient address of the entity that failed to receive the packet. * @param packet IQ packet that failed to be sent to the recipient. */ public void routingFailed( JID recipient, Packet packet ) { Log.debug( "IQ sent to unreachable address: " + packet.toXML() ); final IQ iq = (IQ) packet; // If a route to the target address was not found then try to answer a service_unavailable error code to the sender of the IQ packet if ( iq.isRequest() ) { sendErrorPacket( iq, PacketError.Condition.service_unavailable ); } }
@Override public void deliver(Packet packet) throws UnauthorizedException { final String xml; if (Namespace.NO_NAMESPACE.equals(packet.getElement().getNamespace())) { // use string-based operation here to avoid cascading xmlns wonkery StringBuilder packetXml = new StringBuilder(packet.toXML()); packetXml.insert(packetXml.indexOf(" "), " xmlns=\"jabber:client\""); xml = packetXml.toString(); } else { xml = packet.toXML(); } if (validate()) { deliverRawText(xml); } else { // use fallback delivery mechanism (offline) getPacketDeliverer().deliver(packet); } }
/** * Keeps a log of the XMPP traffic, releasing the wait lock on response received. */ @Override public void interceptPacket(Packet packet, Session session, boolean incoming, boolean processed) throws PacketRejectedException { if (!processed && (ping.getTo().getDomain().equals(packet.getFrom().getDomain()) || ping.getTo().getDomain().equals(packet.getTo().getDomain()))) { // Log all traffic to and from the domain. xml.append(packet.toXML()); xml.append('\n'); // If we've received our IQ response, stop the test. if ( packet instanceof IQ ) { final IQ iq = (IQ) packet; if ( iq.isResponse() && ping.getID().equals( iq.getID() ) && ping.getTo().equals( iq.getFrom() ) ) { Log.info("Successful server to server response received."); waitUntil.release(); } } } }
Log.debug("Failed to route packet to JID: {} packet: {}", jid, packet.toXML());
/** * Make sure that the received packet has a TO and FROM values defined and that it was sent * from a previously validated domain. If the packet does not matches any of the above * conditions then a PacketRejectedException will be thrown. * * @param packet the received packet. * @throws UnauthorizedException if the packet does not include a TO or FROM or if the packet * was sent from a domain that was not previously validated. */ private void packetReceived(Packet packet) throws UnauthorizedException { if (packet.getTo() == null || packet.getFrom() == null) { Log.debug("ServerStanzaHandler: Closing IncomingServerSession due to packet with no TO or FROM: " + packet.toXML()); // Send a stream error saying that the packet includes no TO or FROM StreamError error = new StreamError(StreamError.Condition.improper_addressing); connection.deliverRawText(error.toXML()); throw new UnauthorizedException("Packet with no TO or FROM attributes"); } else if (!((LocalIncomingServerSession) session).isValidDomain(packet.getFrom().getDomain())) { Log.debug("ServerStanzaHandler: Closing IncomingServerSession due to packet with invalid domain: " + packet.toXML()); // Send a stream error saying that the packet includes an invalid FROM StreamError error = new StreamError(StreamError.Condition.invalid_from); connection.deliverRawText(error.toXML()); throw new UnauthorizedException("Packet with no TO or FROM attributes"); } }
" - " + packet.toXML(), e);
Log.warn("Connection Manager failed to process IQ packet: " + packet.toXML());
log.debug( "Message sent to unreachable address: " + packet.toXML() ); final Message msg = (Message) packet; boolean storeOffline = true;
private void returnErrorToSender(Packet packet) { RoutingTable routingTable = XMPPServer.getInstance().getRoutingTable(); if (packet.getError() != null) { Log.debug("Possible double bounce: " + packet.toXML()); Log.debug("XMPP specs forbid us to respond with an IQ error to: " + packet.toXML()); return; Log.debug("Double-bounce of presence: " + packet.toXML()); return; Log.debug("Double-bounce of message: " + packet.toXML()); return;
routed = true; } catch (UnauthorizedException e) { Log.error("Unable to route packet " + packet.toXML(), e);
throw new PacketException("Cannot route packet of type IQ or Presence to bare JID: " + packet.toXML()); if (!clientRoute.isAvailable() && routeOnlyAvailable(packet, fromServer) && !presenceUpdateHandler.hasDirectPresence(packet.getTo(), packet.getFrom())) { Log.debug("Unable to route packet. Packet should only be sent to available sessions and the route is not available. {} ", packet.toXML()); routed = false; } else { localRoutingTable.getRoute(route).process(carbon); } catch (UnauthorizedException e) { Log.error("Unable to route packet " + packet.toXML(), e); routed = true; } catch (UnauthorizedException e) { Log.error("Unable to route packet " + packet.toXML(), e);
router.route( reply ); Log.debug( "Ignoring stanza addressed at conference service: {}", packet.toXML() );
/** * Notification message indicating that a packet has failed to be routed to the recipient. * * @param recipient address of the entity that failed to receive the packet. * @param packet Presence packet that failed to be sent to the recipient. */ public void routingFailed( JID recipient, Packet packet ) { Log.debug( "Presence sent to unreachable address: " + packet.toXML() ); // presence packets are dropped silently } }
logger.debug("SENT: " + packet.toXML());
public void send(Packet packet) { try { logger.debug(packet.toXML()); ComponentManagerFactory.getComponentManager().sendPacket(component, packet); } catch (ComponentException e) { logger.error(GtmsLog.exceptionToString(e)); } }