use of org.jdiameter.api.AvpSet in project jain-slee.diameter by RestComm.
the class ShClientMessageFactoryImpl method createMessage.
protected Message createMessage(DiameterHeader header, DiameterAvp[] avps, int commandCode) throws AvpNotAllowedException {
try {
Message msg = createRawMessage(header, commandCode);
AvpSet set = msg.getAvps();
for (DiameterAvp avp : avps) {
addAvp(avp, set);
}
return msg;
} catch (Exception e) {
logger.error("Unexpected failure trying to create Sh Message.", e);
}
return null;
}
use of org.jdiameter.api.AvpSet in project jain-slee.diameter by RestComm.
the class AvpUtilities method getAvpsAsUnsigned32.
public static long[] getAvpsAsUnsigned32(int avpCode, long vendorId, AvpSet set) {
try {
AvpSet avpSet = set.getAvps(avpCode, vendorId);
long[] values = new long[avpSet.size()];
int i = 0;
for (Avp avp : avpSet) {
values[i++] = avp.getUnsigned32();
}
return values;
} catch (AvpDataException e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to obtain AVP with code " + avpCode + " and Vendor-Id " + vendorId + " as type Unsigned32.", e);
}
return new long[0];
}
}
use of org.jdiameter.api.AvpSet in project jain-slee.diameter by RestComm.
the class AvpUtilities method getAvpsAsInteger32.
public static int[] getAvpsAsInteger32(int avpCode, AvpSet set) {
try {
AvpSet avpSet = set.getAvps(avpCode);
int[] values = new int[avpSet.size()];
int i = 0;
for (Avp avp : avpSet) {
values[i++] = avp.getInteger32();
}
return values;
} catch (AvpDataException e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to obtain AVP with code " + avpCode + " as type Integer32.", e);
}
return new int[0];
}
}
use of org.jdiameter.api.AvpSet in project jain-slee.diameter by RestComm.
the class AvpUtilities method getAvpsAsOctetString.
public static byte[][] getAvpsAsOctetString(int avpCode, AvpSet set) {
try {
AvpSet avpSet = set.getAvps(avpCode);
byte[][] values = new byte[avpSet.size()][];
int i = 0;
for (Avp avp : avpSet) {
values[i++] = avp.getOctetString();
}
return values;
} catch (AvpDataException e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to obtain AVP with code " + avpCode + " as type OctetString.", e);
}
return new byte[0][];
}
}
use of org.jdiameter.api.AvpSet in project jain-slee.diameter by RestComm.
the class AvpUtilities method getAvpsAsUnsigned64.
public static long[] getAvpsAsUnsigned64(int avpCode, AvpSet set) {
try {
AvpSet avpSet = set.getAvps(avpCode);
long[] values = new long[avpSet.size()];
int i = 0;
for (Avp avp : avpSet) {
values[i++] = avp.getUnsigned64();
}
return values;
} catch (AvpDataException e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to obtain AVP with code " + avpCode + " as type Unsigned64.", e);
}
return new long[0];
}
}
Aggregations