Package de.fhkn.in.uce.stun.attribute

Examples of de.fhkn.in.uce.stun.attribute.Username


    private void sendConnectionRequest(final String targetId, final Socket controlConnection) throws Exception {
        logger.debug("Sending connection request"); //$NON-NLS-1$
        final Message requestConnectionMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.CONNECTION_REQUEST);
        requestConnectionMessage.addAttribute(new Username(targetId));
        requestConnectionMessage.addAttribute(new RelayingAttribute());
        requestConnectionMessage.writeTo(controlConnection.getOutputStream());
    }
View Full Code Here


    }

    private void sendConnectionRequest(final String targetId, final Socket controlConnection) throws IOException {
        final Message requestMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.CONNECTION_REQUEST);
        requestMessage.addAttribute(new Username(targetId));
        requestMessage.addAttribute(new ReversalAttribute());
        logger.info("send connection request for target {}", targetId); //$NON-NLS-1$
        requestMessage.writeTo(controlConnection.getOutputStream());
    }
View Full Code Here

    private void sendConnectionRequest(final String targetId, final Socket controlConnection) throws Exception {
        final Message requestConnectionMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.CONNECTION_REQUEST);
        requestConnectionMessage.addAttribute(new DirectconnectionAttribute());
        requestConnectionMessage.addAttribute(new Username(targetId));
        requestConnectionMessage.writeTo(controlConnection.getOutputStream());
    }
View Full Code Here

    @Override
    public void run() {
        try {
            final Message keepAliveMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                    STUNMessageMethod.KEEP_ALIVE);
            final Username userNameAttribute = new Username(this.targetId);
            keepAliveMessage.addAttribute(userNameAttribute);
            keepAliveMessage.writeTo(this.controlConnection.getOutputStream());
        } catch (final Exception e) {
            logger.error("Exception while sending keep-alive message: {}", e.getMessage()); //$NON-NLS-1$
        }
View Full Code Here

    }

    private void handleConnectionRequest(final Message message, final Socket controlConnection) throws Exception {
        this.mediatorUtil.checkForAttribute(message, Username.class);
        this.connectionRequests.putConnectionRequest(new ConnectionRequest(controlConnection, message));
        final Username username = message.getAttribute(Username.class);
        final UserData user = this.userList.getUserDataByUserId(username.getUsernameAsString());
        if (user == null) {
            final String errorMessage = "User " + username.getUsernameAsString() + " not exists"; //$NON-NLS-1$ //$NON-NLS-2$
            this.sendFailureResponse(message, errorMessage, STUNErrorCode.BAD_REQUEST,
                    controlConnection.getOutputStream());
        } else {
            this.callTarget(user, message);
        }
View Full Code Here

    private void handleConnectionRequest(final Message message, final Socket controlConnection) throws Exception {
        this.mediatorUtil.checkForAttribute(message, Username.class);
        this.mediatorUtil.checkForAttribute(message, XorMappedAddress.class);
        this.connectionRequests.putConnectionRequest(new ConnectionRequest(controlConnection, message));
        final Username username = message.getAttribute(Username.class);
        final UserData user = this.userList.getUserDataByUserId(username.getUsernameAsString());
        if (user == null) {
            final String errorMessage = "User " + username.getUsernameAsString() + " not exists"; //$NON-NLS-1$ //$NON-NLS-2$
            this.sendFailureResponse(message, errorMessage, STUNErrorCode.BAD_REQUEST,
                    controlConnection.getOutputStream());
        } else {
            this.forwardConnectionRequest(user, message, controlConnection);
            // this.sendHPMessagesToPeers(user, message, controlConnection);
View Full Code Here

    private NATBehavior requestTargetNatBehavior(final String targetId) throws Exception {
        NATBehavior result = new NATBehavior();
        final Message requestMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.NAT_REQUEST);
        requestMessage.addAttribute(new Username(targetId));
        requestMessage.writeTo(this.mediatorConnection.getControlConnection().getOutputStream());
        final MessageReader messageReader = MessageReader
                .createMessageReaderWithCustomAttributeTypeDecoder(new NATAttributeTypeDecoder());
        final Message response = messageReader.readSTUNMessage(this.mediatorConnection.getControlConnection()
                .getInputStream());
View Full Code Here

    private List<NATTraversalTechniqueAttribute> requestSupportedTraversalTechniquesOfTarget(final String targetId)
            throws Exception {
        final List<NATTraversalTechniqueAttribute> result = new ArrayList<NATTraversalTechniqueAttribute>();
        final Message requestMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.SUPPORTED_TRAV_TECHS_REQUEST);
        requestMessage.addAttribute(new Username(targetId));
        requestMessage.writeTo(this.mediatorConnection.getControlConnection().getOutputStream());
        final MessageReader messageReader = MessageReader
                .createMessageReaderWithCustomAttributeTypeDecoder(new NATAttributeTypeDecoder());
        final Message response = messageReader.readSTUNMessage(this.mediatorConnection.getControlConnection()
                .getInputStream());
View Full Code Here

    private void sendRegisterMessage(final String targetId, final NATBehavior natBehavior,
            final List<NATTraversalTechniqueAttribute> supportedTraversalTechniques) throws Exception {
        final Message registerMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.REGISTER);
        registerMessage.addAttribute(new Username(targetId));
        registerMessage.addAttribute(natBehavior);
        for (final NATTraversalTechniqueAttribute natTraversalTechniqueAttribute : supportedTraversalTechniques) {
            registerMessage.addAttribute(natTraversalTechniqueAttribute);
        }
        registerMessage.writeTo(this.controlConnection.getOutputStream());
View Full Code Here

    }

    private void sendDeregisterMesage(final String targetId) throws Exception {
        final Message deregisterMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.DEREGISTER);
        deregisterMessage.addAttribute(new Username(targetId));
        deregisterMessage.writeTo(this.controlConnection.getOutputStream());
    }
View Full Code Here

TOP

Related Classes of de.fhkn.in.uce.stun.attribute.Username

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.