org.livetribe.slp.spi.msg
Class Message
java.lang.Object
org.livetribe.slp.spi.msg.BytesBlock
org.livetribe.slp.spi.msg.Message
- Direct Known Subclasses:
- Rply, Rqst, SrvAck, SrvDeReg, SrvReg
public abstract class Message
- extends BytesBlock
The RFC 2608 message header is the following:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Version | Function-ID | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Length, contd.|O|F|R| reserved |Next Ext Offset|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Extension Offset, contd.| XID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Language Tag Length | Language Tag \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The RFC 2608 extension is the following:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Extension ID | Next Extension Offset |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Offset, contd.| Extension Data \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Version:
- $Rev: 159 $ $Date: 2006-06-06 22:17:40 +0200 (Tue, 06 Jun 2006) $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SRV_RQST_TYPE
public static final byte SRV_RQST_TYPE
- See Also:
- Constant Field Values
SRV_RPLY_TYPE
public static final byte SRV_RPLY_TYPE
- See Also:
- Constant Field Values
SRV_REG_TYPE
public static final byte SRV_REG_TYPE
- See Also:
- Constant Field Values
SRV_DEREG_TYPE
public static final byte SRV_DEREG_TYPE
- See Also:
- Constant Field Values
SRV_ACK_TYPE
public static final byte SRV_ACK_TYPE
- See Also:
- Constant Field Values
ATTR_RQST_TYPE
public static final byte ATTR_RQST_TYPE
- See Also:
- Constant Field Values
ATTR_RPLY_TYPE
public static final byte ATTR_RPLY_TYPE
- See Also:
- Constant Field Values
DA_ADVERT_TYPE
public static final byte DA_ADVERT_TYPE
- See Also:
- Constant Field Values
SRV_TYPE_RQST_TYPE
public static final byte SRV_TYPE_RQST_TYPE
- See Also:
- Constant Field Values
SRV_TYPE_RPLY_TYPE
public static final byte SRV_TYPE_RPLY_TYPE
- See Also:
- Constant Field Values
SA_ADVERT_TYPE
public static final byte SA_ADVERT_TYPE
- See Also:
- Constant Field Values
Message
public Message()
serializeBody
protected abstract byte[] serializeBody()
throws ServiceLocationException
- Throws:
ServiceLocationException
deserializeBody
protected abstract void deserializeBody(byte[] bytes)
throws ServiceLocationException
- Throws:
ServiceLocationException
serializeExtensions
protected byte[] serializeExtensions(int firstExtensionOffset)
throws ServiceLocationException
- Throws:
ServiceLocationException
deserializeExtensions
protected void deserializeExtensions(byte[] bytes,
int firstExtensionOffset)
throws ServiceLocationException
- Throws:
ServiceLocationException
addExtension
public void addExtension(Extension extension)
getExtensions
public Collection getExtensions()
getMessageType
public abstract byte getMessageType()
isMulticast
public boolean isMulticast()
setMulticast
public void setMulticast(boolean multicast)
isOverflow
public boolean isOverflow()
setOverflow
public void setOverflow(boolean overflow)
isFresh
public boolean isFresh()
setFresh
public void setFresh(boolean fresh)
getXID
public int getXID()
setXID
public void setXID(int xid)
getLanguage
public String getLanguage()
setLanguage
public void setLanguage(String language)
serialize
public byte[] serialize()
throws ServiceLocationException
- Throws:
ServiceLocationException
deserialize
public static Message deserialize(byte[] bytes)
throws ServiceLocationException
- Parses the header of SLP messages, then each message parses its body via
deserializeBody(byte[])
.
- Throws:
ServiceLocationException
- If the bytes cannot be parsed
attributesToBytes
protected static byte[] attributesToBytes(Attributes attributes)
throws ServiceLocationException
- Throws:
ServiceLocationException
scopesToBytes
protected static byte[] scopesToBytes(Scopes scopes)
throws ServiceLocationException
- Throws:
ServiceLocationException
serviceTypeToBytes
protected static byte[] serviceTypeToBytes(ServiceType serviceType)
throws ServiceLocationException
- Throws:
ServiceLocationException
Copyright © 2006-2012 LiveTribe. All Rights Reserved.