Search in sources :

Example 1 with MEIdentityCheckAnswerImpl

use of org.mobicents.slee.resource.diameter.s13.events.MEIdentityCheckAnswerImpl in project jain-slee.diameter by RestComm.

the class DiameterS13ResourceAdaptor 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 MEIdentityCheckRequest.COMMAND_CODE:
            return isRequest ? new MEIdentityCheckRequestImpl(message) : new MEIdentityCheckAnswerImpl(message);
        default:
            return new ExtensionDiameterMessageImpl(message);
    }
}
Also used : MEIdentityCheckRequestImpl(org.mobicents.slee.resource.diameter.s13.events.MEIdentityCheckRequestImpl) MEIdentityCheckAnswerImpl(org.mobicents.slee.resource.diameter.s13.events.MEIdentityCheckAnswerImpl) ExtensionDiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl) SleeEndpoint(javax.slee.resource.SleeEndpoint)

Example 2 with MEIdentityCheckAnswerImpl

use of org.mobicents.slee.resource.diameter.s13.events.MEIdentityCheckAnswerImpl 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)2 MEIdentityCheckAnswerImpl (org.mobicents.slee.resource.diameter.s13.events.MEIdentityCheckAnswerImpl)2 MEIdentityCheckRequestImpl (org.mobicents.slee.resource.diameter.s13.events.MEIdentityCheckRequestImpl)2 SleeEndpoint (javax.slee.resource.SleeEndpoint)1 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)1 Message (org.jdiameter.api.Message)1 ErrorAnswerImpl (org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl)1