use of org.mobicents.slee.resource.diameter.s6a.events.ResetRequestImpl 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);
}
}
use of org.mobicents.slee.resource.diameter.s6a.events.ResetRequestImpl 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;
}
Aggregations