Search in sources :

Example 1 with AuthenticationInformationRequestImpl

use of org.mobicents.slee.resource.diameter.s6a.events.AuthenticationInformationRequestImpl in project jain-slee.diameter by RestComm.

the class DiameterS6aResourceAdaptor method createEvent.

/**
 * Create Event object from a JDiameter message (request or answer)
 *
 * @return a DiameterMessage object wrapping the request/answer
 * @throws OperationNotSupportedException
 */
private DiameterMessage createEvent(Message message) {
    if (message == null) {
        throw new NullPointerException("Message argument cannot be null while creating event.");
    }
    int commandCode = message.getCommandCode();
    if (message.isError()) {
        return new ErrorAnswerImpl(message);
    }
    boolean isRequest = message.isRequest();
    switch(commandCode) {
        case UpdateLocationRequest.COMMAND_CODE:
            return isRequest ? new UpdateLocationRequestImpl(message) : new UpdateLocationAnswerImpl(message);
        case AuthenticationInformationRequest.COMMAND_CODE:
            return isRequest ? new AuthenticationInformationRequestImpl(message) : new AuthenticationInformationAnswerImpl(message);
        case CancelLocationRequest.COMMAND_CODE:
            return isRequest ? new CancelLocationRequestImpl(message) : new CancelLocationAnswerImpl(message);
        case InsertSubscriberDataRequest.COMMAND_CODE:
            return isRequest ? new InsertSubscriberDataRequestImpl(message) : new InsertSubscriberDataAnswerImpl(message);
        case DeleteSubscriberDataRequest.COMMAND_CODE:
            return isRequest ? new DeleteSubscriberDataRequestImpl(message) : new DeleteSubscriberDataAnswerImpl(message);
        case PurgeUERequest.COMMAND_CODE:
            return isRequest ? new PurgeUERequestImpl(message) : new PurgeUEAnswerImpl(message);
        case ResetRequest.COMMAND_CODE:
            return isRequest ? new ResetRequestImpl(message) : new ResetAnswerImpl(message);
        case NotifyRequest.COMMAND_CODE:
            return isRequest ? new NotifyRequestImpl(message) : new NotifyAnswerImpl(message);
        default:
            return new ExtensionDiameterMessageImpl(message);
    }
}
Also used : UpdateLocationAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.UpdateLocationAnswerImpl) UpdateLocationRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.UpdateLocationRequestImpl) NotifyRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.NotifyRequestImpl) PurgeUEAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.PurgeUEAnswerImpl) CancelLocationRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.CancelLocationRequestImpl) NotifyAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.NotifyAnswerImpl) InsertSubscriberDataRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.InsertSubscriberDataRequestImpl) DeleteSubscriberDataAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.DeleteSubscriberDataAnswerImpl) ExtensionDiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl) ResetRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.ResetRequestImpl) SleeEndpoint(javax.slee.resource.SleeEndpoint) AuthenticationInformationAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.AuthenticationInformationAnswerImpl) DeleteSubscriberDataRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.DeleteSubscriberDataRequestImpl) ResetAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.ResetAnswerImpl) AuthenticationInformationRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.AuthenticationInformationRequestImpl) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl) CancelLocationAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.CancelLocationAnswerImpl) InsertSubscriberDataAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.InsertSubscriberDataAnswerImpl) PurgeUERequestImpl(org.mobicents.slee.resource.diameter.s6a.events.PurgeUERequestImpl)

Example 2 with AuthenticationInformationRequestImpl

use of org.mobicents.slee.resource.diameter.s6a.events.AuthenticationInformationRequestImpl in project jain-slee.diameter by RestComm.

the class S6aMessageFactoryImpl method createS6aMessage.

/**
 * Creates a S6a Message with specified command-code and avps filled. If a header is present an answer will be created, if not
 * it will generate a request.
 *
 * @param diameterHeader
 * @param avps
 * @param _commandCode
 * @param appId
 * @return
 * @throws InternalException
 */
DiameterMessage createS6aMessage(DiameterHeader diameterHeader, DiameterAvp[] avps, int _commandCode, ApplicationId appId) throws InternalException {
    boolean creatingRequest = diameterHeader == null;
    Message msg = null;
    if (!creatingRequest) {
        Message raw = createMessage(diameterHeader, avps, 0, appId);
        raw.setProxiable(diameterHeader.isProxiable());
        raw.setRequest(false);
        // just in case. answers never have T flag set
        raw.setReTransmitted(false);
        // FIXME ? raw.getAvps().removeAvp(Avp.AUTH_APPLICATION_ID);
        msg = raw;
    } else {
        Message raw = createMessage(diameterHeader, avps, _commandCode, appId);
        raw.setProxiable(true);
        raw.setRequest(true);
        msg = raw;
    }
    int commandCode = creatingRequest ? _commandCode : diameterHeader.getCommandCode();
    DiameterMessage diamMessage = null;
    switch(commandCode) {
        case UpdateLocationRequest.COMMAND_CODE:
            diamMessage = creatingRequest ? new UpdateLocationRequestImpl(msg) : new UpdateLocationAnswerImpl(msg);
            break;
        case AuthenticationInformationRequest.COMMAND_CODE:
            diamMessage = creatingRequest ? new AuthenticationInformationRequestImpl(msg) : new AuthenticationInformationAnswerImpl(msg);
            break;
        case CancelLocationRequest.COMMAND_CODE:
            diamMessage = creatingRequest ? new CancelLocationRequestImpl(msg) : new CancelLocationAnswerImpl(msg);
            break;
        case InsertSubscriberDataRequest.COMMAND_CODE:
            diamMessage = creatingRequest ? new InsertSubscriberDataRequestImpl(msg) : new InsertSubscriberDataAnswerImpl(msg);
            break;
        case DeleteSubscriberDataRequest.COMMAND_CODE:
            diamMessage = creatingRequest ? new DeleteSubscriberDataRequestImpl(msg) : new DeleteSubscriberDataAnswerImpl(msg);
            break;
        case PurgeUERequest.COMMAND_CODE:
            diamMessage = creatingRequest ? new PurgeUERequestImpl(msg) : new PurgeUEAnswerImpl(msg);
            break;
        case ResetRequest.COMMAND_CODE:
            diamMessage = creatingRequest ? new ResetRequestImpl(msg) : new ResetAnswerImpl(msg);
            break;
        case NotifyRequest.COMMAND_CODE:
            diamMessage = creatingRequest ? new NotifyRequestImpl(msg) : new NotifyAnswerImpl(msg);
            break;
        default:
            diamMessage = new ExtensionDiameterMessageImpl(msg);
    }
    if (!diamMessage.hasSessionId() && session != null) {
        diamMessage.setSessionId(session.getSessionId());
    }
    return diamMessage;
}
Also used : UpdateLocationAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.UpdateLocationAnswerImpl) UpdateLocationRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.UpdateLocationRequestImpl) Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) NotifyRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.NotifyRequestImpl) PurgeUEAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.PurgeUEAnswerImpl) CancelLocationRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.CancelLocationRequestImpl) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) NotifyAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.NotifyAnswerImpl) InsertSubscriberDataRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.InsertSubscriberDataRequestImpl) DeleteSubscriberDataAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.DeleteSubscriberDataAnswerImpl) ExtensionDiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl) ResetRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.ResetRequestImpl) AuthenticationInformationAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.AuthenticationInformationAnswerImpl) DeleteSubscriberDataRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.DeleteSubscriberDataRequestImpl) ResetAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.ResetAnswerImpl) AuthenticationInformationRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.AuthenticationInformationRequestImpl) CancelLocationAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.CancelLocationAnswerImpl) InsertSubscriberDataAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.InsertSubscriberDataAnswerImpl) PurgeUERequestImpl(org.mobicents.slee.resource.diameter.s6a.events.PurgeUERequestImpl)

Aggregations

ExtensionDiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl)2 AuthenticationInformationAnswerImpl (org.mobicents.slee.resource.diameter.s6a.events.AuthenticationInformationAnswerImpl)2 AuthenticationInformationRequestImpl (org.mobicents.slee.resource.diameter.s6a.events.AuthenticationInformationRequestImpl)2 CancelLocationAnswerImpl (org.mobicents.slee.resource.diameter.s6a.events.CancelLocationAnswerImpl)2 CancelLocationRequestImpl (org.mobicents.slee.resource.diameter.s6a.events.CancelLocationRequestImpl)2 DeleteSubscriberDataAnswerImpl (org.mobicents.slee.resource.diameter.s6a.events.DeleteSubscriberDataAnswerImpl)2 DeleteSubscriberDataRequestImpl (org.mobicents.slee.resource.diameter.s6a.events.DeleteSubscriberDataRequestImpl)2 InsertSubscriberDataAnswerImpl (org.mobicents.slee.resource.diameter.s6a.events.InsertSubscriberDataAnswerImpl)2 InsertSubscriberDataRequestImpl (org.mobicents.slee.resource.diameter.s6a.events.InsertSubscriberDataRequestImpl)2 NotifyAnswerImpl (org.mobicents.slee.resource.diameter.s6a.events.NotifyAnswerImpl)2 NotifyRequestImpl (org.mobicents.slee.resource.diameter.s6a.events.NotifyRequestImpl)2 PurgeUEAnswerImpl (org.mobicents.slee.resource.diameter.s6a.events.PurgeUEAnswerImpl)2 PurgeUERequestImpl (org.mobicents.slee.resource.diameter.s6a.events.PurgeUERequestImpl)2 ResetAnswerImpl (org.mobicents.slee.resource.diameter.s6a.events.ResetAnswerImpl)2 ResetRequestImpl (org.mobicents.slee.resource.diameter.s6a.events.ResetRequestImpl)2 UpdateLocationAnswerImpl (org.mobicents.slee.resource.diameter.s6a.events.UpdateLocationAnswerImpl)2 UpdateLocationRequestImpl (org.mobicents.slee.resource.diameter.s6a.events.UpdateLocationRequestImpl)2 SleeEndpoint (javax.slee.resource.SleeEndpoint)1 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)1 Message (org.jdiameter.api.Message)1