Search in sources :

Example 1 with AbortSessionRequestImpl

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

the class DiameterMessageFactoryImpl method createDiameterMessage.

protected DiameterMessage createDiameterMessage(DiameterHeader diameterHeader, DiameterAvp[] avps, int _commandCode, ApplicationId appId) throws IllegalArgumentException {
    boolean creatingRequest = diameterHeader == null;
    Message msg = null;
    if (!creatingRequest) {
        Message raw = createMessage(diameterHeader, avps, 0, appId);
        // raw.setProxiable(true);
        raw.setRequest(false);
        // just in case. answers never have T flag set
        raw.setReTransmitted(false);
        msg = raw;
    } else {
        Message raw = createMessage(diameterHeader, avps, _commandCode, appId);
        boolean isPeerManagementMessage = _commandCode == CapabilitiesExchangeRequest.commandCode || _commandCode == DeviceWatchdogRequest.commandCode || _commandCode == DisconnectPeerRequest.commandCode;
        raw.setProxiable(!isPeerManagementMessage);
        raw.setRequest(true);
        msg = raw;
    }
    int commandCode = creatingRequest ? _commandCode : diameterHeader.getCommandCode();
    DiameterMessage diamMessage = null;
    switch(commandCode) {
        case Message.ABORT_SESSION_REQUEST:
            diamMessage = creatingRequest ? new AbortSessionRequestImpl(msg) : new AbortSessionAnswerImpl(msg);
            break;
        case Message.ACCOUNTING_REQUEST:
            diamMessage = creatingRequest ? new AccountingRequestImpl(msg) : new AccountingAnswerImpl(msg);
            break;
        case Message.CAPABILITIES_EXCHANGE_REQUEST:
            diamMessage = creatingRequest ? new CapabilitiesExchangeRequestImpl(msg) : new CapabilitiesExchangeAnswerImpl(msg);
            break;
        case Message.DEVICE_WATCHDOG_REQUEST:
            diamMessage = creatingRequest ? new DeviceWatchdogRequestImpl(msg) : new DeviceWatchdogAnswerImpl(msg);
            break;
        case Message.DISCONNECT_PEER_REQUEST:
            diamMessage = creatingRequest ? new DisconnectPeerRequestImpl(msg) : new DisconnectPeerAnswerImpl(msg);
            break;
        case Message.RE_AUTH_REQUEST:
            diamMessage = creatingRequest ? new ReAuthRequestImpl(msg) : new ReAuthAnswerImpl(msg);
            break;
        case Message.SESSION_TERMINATION_REQUEST:
            diamMessage = creatingRequest ? new SessionTerminationRequestImpl(msg) : new SessionTerminationAnswerImpl(msg);
            break;
        default:
            diamMessage = new ExtensionDiameterMessageImpl(msg);
    }
    // Finally, add Origin-Host and Origin-Realm, if not present.
    addOriginHostAndRealm(diamMessage);
    return diamMessage;
}
Also used : DisconnectPeerRequestImpl(org.mobicents.slee.resource.diameter.base.events.DisconnectPeerRequestImpl) AccountingAnswerImpl(org.mobicents.slee.resource.diameter.base.events.AccountingAnswerImpl) Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) ExtensionDiameterMessage(net.java.slee.resource.diameter.base.events.ExtensionDiameterMessage) AbortSessionAnswerImpl(org.mobicents.slee.resource.diameter.base.events.AbortSessionAnswerImpl) AccountingRequestImpl(org.mobicents.slee.resource.diameter.base.events.AccountingRequestImpl) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) ExtensionDiameterMessage(net.java.slee.resource.diameter.base.events.ExtensionDiameterMessage) ExtensionDiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl) DisconnectPeerAnswerImpl(org.mobicents.slee.resource.diameter.base.events.DisconnectPeerAnswerImpl) ReAuthRequestImpl(org.mobicents.slee.resource.diameter.base.events.ReAuthRequestImpl) AbortSessionRequestImpl(org.mobicents.slee.resource.diameter.base.events.AbortSessionRequestImpl) DeviceWatchdogRequestImpl(org.mobicents.slee.resource.diameter.base.events.DeviceWatchdogRequestImpl) SessionTerminationAnswerImpl(org.mobicents.slee.resource.diameter.base.events.SessionTerminationAnswerImpl) CapabilitiesExchangeRequestImpl(org.mobicents.slee.resource.diameter.base.events.CapabilitiesExchangeRequestImpl) CapabilitiesExchangeAnswerImpl(org.mobicents.slee.resource.diameter.base.events.CapabilitiesExchangeAnswerImpl) ReAuthAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ReAuthAnswerImpl) SessionTerminationRequestImpl(org.mobicents.slee.resource.diameter.base.events.SessionTerminationRequestImpl) DeviceWatchdogAnswerImpl(org.mobicents.slee.resource.diameter.base.events.DeviceWatchdogAnswerImpl)

Example 2 with AbortSessionRequestImpl

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

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

the class DiameterGxResourceAdaptor 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 // CCR/CCA
        GxCreditControlRequest.commandCode:
            return isRequest ? new GxCreditControlRequestImpl(message) : new GxCreditControlAnswerImpl(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
        GxReAuthAnswer.commandCode:
            return isRequest ? new GxReAuthRequestImpl(message) : new GxReAuthAnswerImpl(message);
        case // ACR/ACA
        AccountingAnswer.commandCode:
            return isRequest ? new AccountingRequestImpl(message) : new AccountingAnswerImpl(message);
        default:
            return new ExtensionDiameterMessageImpl(message);
    }
}
Also used : AccountingAnswerImpl(org.mobicents.slee.resource.diameter.base.events.AccountingAnswerImpl) AbortSessionAnswerImpl(org.mobicents.slee.resource.diameter.base.events.AbortSessionAnswerImpl) GxReAuthRequestImpl(org.mobicents.slee.resource.diameter.gx.events.GxReAuthRequestImpl) AccountingRequestImpl(org.mobicents.slee.resource.diameter.base.events.AccountingRequestImpl) ExtensionDiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl) SleeEndpoint(javax.slee.resource.SleeEndpoint) AbortSessionRequestImpl(org.mobicents.slee.resource.diameter.base.events.AbortSessionRequestImpl) SessionTerminationAnswerImpl(org.mobicents.slee.resource.diameter.base.events.SessionTerminationAnswerImpl) GxCreditControlAnswerImpl(org.mobicents.slee.resource.diameter.gx.events.GxCreditControlAnswerImpl) GxCreditControlRequestImpl(org.mobicents.slee.resource.diameter.gx.events.GxCreditControlRequestImpl) GxReAuthAnswerImpl(org.mobicents.slee.resource.diameter.gx.events.GxReAuthAnswerImpl) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl) SessionTerminationRequestImpl(org.mobicents.slee.resource.diameter.base.events.SessionTerminationRequestImpl)

Aggregations

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 ExtensionDiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl)3 SessionTerminationAnswerImpl (org.mobicents.slee.resource.diameter.base.events.SessionTerminationAnswerImpl)3 SessionTerminationRequestImpl (org.mobicents.slee.resource.diameter.base.events.SessionTerminationRequestImpl)3 SleeEndpoint (javax.slee.resource.SleeEndpoint)2 ErrorAnswerImpl (org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl)2 ReAuthAnswerImpl (org.mobicents.slee.resource.diameter.base.events.ReAuthAnswerImpl)2 ReAuthRequestImpl (org.mobicents.slee.resource.diameter.base.events.ReAuthRequestImpl)2 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)1 ExtensionDiameterMessage (net.java.slee.resource.diameter.base.events.ExtensionDiameterMessage)1 Message (org.jdiameter.api.Message)1 CapabilitiesExchangeAnswerImpl (org.mobicents.slee.resource.diameter.base.events.CapabilitiesExchangeAnswerImpl)1 CapabilitiesExchangeRequestImpl (org.mobicents.slee.resource.diameter.base.events.CapabilitiesExchangeRequestImpl)1 DeviceWatchdogAnswerImpl (org.mobicents.slee.resource.diameter.base.events.DeviceWatchdogAnswerImpl)1 DeviceWatchdogRequestImpl (org.mobicents.slee.resource.diameter.base.events.DeviceWatchdogRequestImpl)1 DisconnectPeerAnswerImpl (org.mobicents.slee.resource.diameter.base.events.DisconnectPeerAnswerImpl)1 DisconnectPeerRequestImpl (org.mobicents.slee.resource.diameter.base.events.DisconnectPeerRequestImpl)1