Search in sources :

Example 6 with ExtensionDiameterMessageImpl

use of org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl 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 7 with ExtensionDiameterMessageImpl

use of org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl 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)

Example 8 with ExtensionDiameterMessageImpl

use of org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl in project jain-slee.diameter by RestComm.

the class DiameterRoResourceAdaptor 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 // CCR/CCA
        RoCreditControlRequest.commandCode:
            return isRequest ? new RoCreditControlRequestImpl(message) : new RoCreditControlAnswerImpl(message);
        case // ASR/ASA
        AbortSessionAnswer.commandCode:
            return isRequest ? new AbortSessionRequestImpl(message) : new AbortSessionAnswerImpl(message);
        case // STR/STA
        SessionTerminationAnswer.commandCode:
            return isRequest ? new SessionTerminationRequestImpl(message) : new SessionTerminationAnswerImpl(message);
        case // RAR/RAA
        ReAuthAnswer.commandCode:
            return isRequest ? new ReAuthRequestImpl(message) : new ReAuthAnswerImpl(message);
        case // ACR/ACA
        AccountingAnswer.commandCode:
            return isRequest ? new AccountingRequestImpl(message) : new AccountingAnswerImpl(message);
        default:
            return new ExtensionDiameterMessageImpl(message);
    }
}
Also used : RoCreditControlRequestImpl(org.mobicents.slee.resource.diameter.ro.events.RoCreditControlRequestImpl) AccountingAnswerImpl(org.mobicents.slee.resource.diameter.base.events.AccountingAnswerImpl) AbortSessionAnswerImpl(org.mobicents.slee.resource.diameter.base.events.AbortSessionAnswerImpl) AccountingRequestImpl(org.mobicents.slee.resource.diameter.base.events.AccountingRequestImpl) RoCreditControlAnswerImpl(org.mobicents.slee.resource.diameter.ro.events.RoCreditControlAnswerImpl) ExtensionDiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl) SleeEndpoint(javax.slee.resource.SleeEndpoint) ReAuthRequestImpl(org.mobicents.slee.resource.diameter.base.events.ReAuthRequestImpl) AbortSessionRequestImpl(org.mobicents.slee.resource.diameter.base.events.AbortSessionRequestImpl) SessionTerminationAnswerImpl(org.mobicents.slee.resource.diameter.base.events.SessionTerminationAnswerImpl) ReAuthAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ReAuthAnswerImpl) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl) SessionTerminationRequestImpl(org.mobicents.slee.resource.diameter.base.events.SessionTerminationRequestImpl)

Example 9 with ExtensionDiameterMessageImpl

use of org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl in project jain-slee.diameter by RestComm.

the class DiameterRxResourceAdaptor 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(final Message message) {
    if (message == null) {
        throw new NullPointerException("Message argument cannot be null while creating event.");
    }
    final int commandCode = message.getCommandCode();
    if (message.isError()) {
        return new ErrorAnswerImpl(message);
    }
    final boolean isRequest = message.isRequest();
    switch(commandCode) {
        case // AAR/AAA
        AARequest.commandCode:
            return isRequest ? new AARequestImpl(message) : new AAAnswerImpl(message);
        case // ASR/ASA
        AbortSessionAnswer.commandCode:
            return isRequest ? new AbortSessionRequestImpl(message) : new AbortSessionAnswerImpl(message);
        case // STR/STA
        SessionTerminationAnswer.commandCode:
            return isRequest ? new SessionTerminationRequestImpl(message) : new SessionTerminationAnswerImpl(message);
        case // RAR/RAA
        ReAuthAnswer.commandCode:
            return isRequest ? new ReAuthRequestImpl(message) : new ReAuthAnswerImpl(message);
        default:
            return new ExtensionDiameterMessageImpl(message);
    }
}
Also used : AbortSessionAnswerImpl(org.mobicents.slee.resource.diameter.rx.events.AbortSessionAnswerImpl) ExtensionDiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl) SleeEndpoint(javax.slee.resource.SleeEndpoint) ReAuthRequestImpl(org.mobicents.slee.resource.diameter.rx.events.ReAuthRequestImpl) AbortSessionRequestImpl(org.mobicents.slee.resource.diameter.rx.events.AbortSessionRequestImpl) SessionTerminationAnswerImpl(org.mobicents.slee.resource.diameter.rx.events.SessionTerminationAnswerImpl) AAAnswerImpl(org.mobicents.slee.resource.diameter.rx.events.AAAnswerImpl) ReAuthAnswerImpl(org.mobicents.slee.resource.diameter.rx.events.ReAuthAnswerImpl) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl) AARequestImpl(org.mobicents.slee.resource.diameter.rx.events.AARequestImpl) SessionTerminationRequestImpl(org.mobicents.slee.resource.diameter.rx.events.SessionTerminationRequestImpl)

Example 10 with ExtensionDiameterMessageImpl

use of org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl in project jain-slee.diameter by RestComm.

the class S13MessageFactoryImpl method createS13Message.

/**
 * Creates a S13 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 createS13Message(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 MEIdentityCheckRequest.COMMAND_CODE:
            diamMessage = creatingRequest ? new MEIdentityCheckRequestImpl(msg) : new MEIdentityCheckAnswerImpl(msg);
            break;
        default:
            diamMessage = new ExtensionDiameterMessageImpl(msg);
    }
    if (!diamMessage.hasSessionId() && session != null) {
        diamMessage.setSessionId(session.getSessionId());
    }
    return diamMessage;
}
Also used : DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) Message(org.jdiameter.api.Message) MEIdentityCheckRequestImpl(org.mobicents.slee.resource.diameter.s13.events.MEIdentityCheckRequestImpl) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) MEIdentityCheckAnswerImpl(org.mobicents.slee.resource.diameter.s13.events.MEIdentityCheckAnswerImpl) ExtensionDiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl)

Aggregations

ExtensionDiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl)15 SleeEndpoint (javax.slee.resource.SleeEndpoint)10 ErrorAnswerImpl (org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl)10 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)4 Message (org.jdiameter.api.Message)4 AbortSessionAnswerImpl (org.mobicents.slee.resource.diameter.base.events.AbortSessionAnswerImpl)3 AbortSessionRequestImpl (org.mobicents.slee.resource.diameter.base.events.AbortSessionRequestImpl)3 AccountingAnswerImpl (org.mobicents.slee.resource.diameter.base.events.AccountingAnswerImpl)3 AccountingRequestImpl (org.mobicents.slee.resource.diameter.base.events.AccountingRequestImpl)3 SessionTerminationAnswerImpl (org.mobicents.slee.resource.diameter.base.events.SessionTerminationAnswerImpl)2 SessionTerminationRequestImpl (org.mobicents.slee.resource.diameter.base.events.SessionTerminationRequestImpl)2 LocationInfoAnswerImpl (org.mobicents.slee.resource.diameter.cxdx.events.LocationInfoAnswerImpl)2 LocationInfoRequestImpl (org.mobicents.slee.resource.diameter.cxdx.events.LocationInfoRequestImpl)2 MultimediaAuthenticationAnswerImpl (org.mobicents.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswerImpl)2 MultimediaAuthenticationRequestImpl (org.mobicents.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequestImpl)2 PushProfileAnswerImpl (org.mobicents.slee.resource.diameter.cxdx.events.PushProfileAnswerImpl)2 PushProfileRequestImpl (org.mobicents.slee.resource.diameter.cxdx.events.PushProfileRequestImpl)2 RegistrationTerminationAnswerImpl (org.mobicents.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswerImpl)2 RegistrationTerminationRequestImpl (org.mobicents.slee.resource.diameter.cxdx.events.RegistrationTerminationRequestImpl)2 ServerAssignmentAnswerImpl (org.mobicents.slee.resource.diameter.cxdx.events.ServerAssignmentAnswerImpl)2