Search in sources :

Example 61 with DiameterAvp

use of net.java.slee.resource.diameter.base.events.avp.DiameterAvp in project jain-slee.diameter by RestComm.

the class GqMessageFactoryImpl method createMessage.

public Message createMessage(DiameterHeader header, DiameterAvp[] avps) throws AvpNotAllowedException {
    Message msg = createRawMessage(header);
    AvpSet set = msg.getAvps();
    for (DiameterAvp avp : avps) {
        addAvp(avp, set);
    }
    return msg;
}
Also used : Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) AvpSet(org.jdiameter.api.AvpSet)

Example 62 with DiameterAvp

use of net.java.slee.resource.diameter.base.events.avp.DiameterAvp in project jain-slee.diameter by RestComm.

the class GqMessageFactoryImpl method createMessage.

public Message createMessage(int commandCode, DiameterAvp[] avps) throws AvpNotAllowedException {
    Message msg = createRawMessage(commandCode);
    AvpSet set = msg.getAvps();
    for (DiameterAvp avp : avps) {
        addAvp(avp, set);
    }
    return msg;
}
Also used : Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) AvpSet(org.jdiameter.api.AvpSet)

Example 63 with DiameterAvp

use of net.java.slee.resource.diameter.base.events.avp.DiameterAvp in project jain-slee.diameter by RestComm.

the class RfMessageFactoryImpl method createRfAccountingRequest.

public RfAccountingRequest createRfAccountingRequest(AccountingRecordType accountingrecordtype) {
    DiameterAvp[] avps = new DiameterAvp[] {};
    RfAccountingRequest acr = (RfAccountingRequest) createRfAccountingMessage(null, avps);
    if (this.sessionId != null) {
        acr.setSessionId(sessionId);
    }
    // acr.setAcctApplicationId(_RF_ACC_APP_ID);
    acr.setAccountingRecordType(accountingrecordtype);
    return acr;
}
Also used : DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) RfAccountingRequest(net.java.slee.resource.diameter.rf.events.RfAccountingRequest)

Example 64 with DiameterAvp

use of net.java.slee.resource.diameter.base.events.avp.DiameterAvp in project jain-slee.diameter by RestComm.

the class RfMessageFactoryImpl method createMessage.

public Message createMessage(DiameterHeader header, DiameterAvp[] avps) throws AvpNotAllowedException {
    Message msg = createRawMessage(header);
    AvpSet set = msg.getAvps();
    for (DiameterAvp avp : avps) {
        addAvp(avp, set);
    }
    return msg;
}
Also used : Message(org.jdiameter.api.Message) RfAccountingMessage(net.java.slee.resource.diameter.rf.events.RfAccountingMessage) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) AvpSet(org.jdiameter.api.AvpSet)

Example 65 with DiameterAvp

use of net.java.slee.resource.diameter.base.events.avp.DiameterAvp in project jain-slee.diameter by RestComm.

the class RfMessageFactoryImpl method addAvp.

protected void addAvp(DiameterAvp avp, AvpSet set) {
    // FIXME: alexandre: Should we look at the types and add them with proper function?
    if (avp instanceof GroupedAvp) {
        AvpSet avpSet = set.addGroupedAvp(avp.getCode(), avp.getVendorId(), avp.getMandatoryRule() == 1, avp.getProtectedRule() == 1);
        DiameterAvp[] groupedAVPs = ((GroupedAvp) avp).getExtensionAvps();
        for (DiameterAvp avpFromGroup : groupedAVPs) {
            addAvp(avpFromGroup, avpSet);
        }
    } else if (avp != null) {
        set.addAvp(avp.getCode(), avp.byteArrayValue(), avp.getVendorId(), avp.getMandatoryRule() == 1, avp.getProtectedRule() == 1);
    }
}
Also used : GroupedAvp(net.java.slee.resource.diameter.base.events.avp.GroupedAvp) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) AvpSet(org.jdiameter.api.AvpSet)

Aggregations

DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)65 Message (org.jdiameter.api.Message)22 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)21 InternalException (org.jdiameter.api.InternalException)21 AvpSet (org.jdiameter.api.AvpSet)18 ArrayList (java.util.ArrayList)15 GroupedAvp (net.java.slee.resource.diameter.base.events.avp.GroupedAvp)15 NoSuchAvpException (net.java.slee.resource.diameter.base.NoSuchAvpException)12 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)9 IllegalDiameterStateException (org.jdiameter.api.IllegalDiameterStateException)6 AccountingRequest (net.java.slee.resource.diameter.base.events.AccountingRequest)3 VendorSpecificApplicationIdAvp (net.java.slee.resource.diameter.base.events.avp.VendorSpecificApplicationIdAvp)3 GxCreditControlMessage (net.java.slee.resource.diameter.gx.events.GxCreditControlMessage)3 GxReAuthMessage (net.java.slee.resource.diameter.gx.events.GxReAuthMessage)3 Test (org.junit.Test)3 IOException (java.io.IOException)2 DiameterIdentity (net.java.slee.resource.diameter.base.events.avp.DiameterIdentity)2 CreditControlRequest (net.java.slee.resource.diameter.cca.events.CreditControlRequest)2 RoCreditControlMessage (net.java.slee.resource.diameter.ro.events.RoCreditControlMessage)2 ApplicationId (org.jdiameter.api.ApplicationId)2