Class ImmutableDiameterMessage
- java.lang.Object
-
- io.snice.codecs.codec.diameter.impl.ImmutableDiameterMessage
-
- All Implemented Interfaces:
DiameterMessage
,Cloneable
- Direct Known Subclasses:
ImmutableDiameterAnswer
,ImmutableDiameterRequest
public abstract class ImmutableDiameterMessage extends Object implements DiameterMessage
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.snice.codecs.codec.diameter.DiameterMessage
DiameterMessage.Builder<T extends DiameterMessage>
-
-
Field Summary
Fields Modifier and Type Field Description protected DiameterHeader
header
-
Constructor Summary
Constructors Constructor Description ImmutableDiameterMessage(io.snice.buffer.Buffer raw, DiameterHeader header, List<FramedAvp> avps, short indexOrigHost, short indexOrigRealm, short indexDestHost, short indexDestRealm, short indexResultCode, short indexExperimentalResultCode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DiameterMessage
clone()
This class is immutable and as such, when cloning, you'll just get back the same reference again.boolean
equals(Object other)
List<FramedAvp>
getAllAvps()
Optional<FramedAvp>
getAvp(long code)
Get anFramedAvp
.io.snice.buffer.Buffer
getBuffer()
Get the entireDiameterMessage
as aBuffer
, which you then can use to e.g.Optional<DestinationHost>
getDestinationHost()
Optional<DestinationRealm>
getDestinationRealm()
DiameterHeader
getHeader()
protected io.snice.functional.Either<ExperimentalResult,ResultCode>
getInternalResultCode()
OriginHost
getOriginHost()
TheOriginHost
MUST be present in all diameter messages.OriginRealm
getOriginRealm()
TheOriginRealm
MUST be present in all diameter messages.String
toString()
-
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.snice.codecs.codec.diameter.DiameterMessage
copy, createAnswer, createAnswer, getAvps, isAIA, isAIR, isAnswer, isCEA, isCER, isCLA, isCLR, isDPA, isDPR, isDSA, isDSR, isDWA, isDWR, isIDA, isIDR, isNOA, isNOR, isPUA, isPUR, isRequest, isRSA, isRSR, isULA, isULR, toAnswer, toRequest, validate, validate
-
-
-
-
Field Detail
-
header
protected final DiameterHeader header
-
-
Constructor Detail
-
ImmutableDiameterMessage
public ImmutableDiameterMessage(io.snice.buffer.Buffer raw, DiameterHeader header, List<FramedAvp> avps, short indexOrigHost, short indexOrigRealm, short indexDestHost, short indexDestRealm, short indexResultCode, short indexExperimentalResultCode)
-
-
Method Detail
-
getAvp
public Optional<FramedAvp> getAvp(long code)
Description copied from interface:DiameterMessage
Get anFramedAvp
. If there are multiple AVPs present, only the first one will be returned. UseDiameterMessage.getAvps(long)
to retrieve those AVPs that may be present multiple times.- Specified by:
getAvp
in interfaceDiameterMessage
- Returns:
- an
Optional
FramedAvp
-
getHeader
public DiameterHeader getHeader()
- Specified by:
getHeader
in interfaceDiameterMessage
-
getAllAvps
public List<FramedAvp> getAllAvps()
- Specified by:
getAllAvps
in interfaceDiameterMessage
-
getBuffer
public io.snice.buffer.Buffer getBuffer()
Description copied from interface:DiameterMessage
Get the entireDiameterMessage
as aBuffer
, which you then can use to e.g. write to network socket.- Specified by:
getBuffer
in interfaceDiameterMessage
-
clone
public DiameterMessage clone()
This class is immutable and as such, when cloning, you'll just get back the same reference again.- Specified by:
clone
in interfaceDiameterMessage
- Overrides:
clone
in classObject
- Returns:
-
getOriginHost
public OriginHost getOriginHost()
Description copied from interface:DiameterMessage
TheOriginHost
MUST be present in all diameter messages.- Specified by:
getOriginHost
in interfaceDiameterMessage
- Returns:
- the
OriginHost
or, as discussed inDiameterMessage.getOriginRealm()
, null if it isn't present which means that this is actually a malformedDiameterMessage
.
-
getOriginRealm
public OriginRealm getOriginRealm()
Description copied from interface:DiameterMessage
TheOriginRealm
MUST be present in all diameter messages. But is actually allowed to be null, see note below. However, even though this is indeed a mandatory AVP the snice diameter library does not enforce it by default. The reason is that if you are a security researcher, or someone that is perhaps building testing tools, you may want to be able to create an incorrectDiameterMessage
. It is up to the actual diameter application/stack to, if that author so wishes, to enforce this so that applications built on top of it is guaranteed this.- Specified by:
getOriginRealm
in interfaceDiameterMessage
- Returns:
- the
OriginRealm
or, as discussed above, null if it isn't present which means that this is actually a malformedDiameterMessage
.
-
getDestinationRealm
public Optional<DestinationRealm> getDestinationRealm()
- Specified by:
getDestinationRealm
in interfaceDiameterMessage
-
getDestinationHost
public Optional<DestinationHost> getDestinationHost()
- Specified by:
getDestinationHost
in interfaceDiameterMessage
-
getInternalResultCode
protected io.snice.functional.Either<ExperimentalResult,ResultCode> getInternalResultCode()
-
-