be.lassi.lanbox.udp
Class UdpPacketParser
java.lang.Object
  
be.lassi.lanbox.udp.UdpPacketParser
public class UdpPacketParser
- extends java.lang.Object
 
Parses a Lanbox UDP packet and translates it to an UdpPacket object.
 
 A Lanbox UDP packet consists of a 4-byte packet header followed by one or more 
 messages.  If a message has odd length, then a padding byte is added 
 to make sure the next message is at a 16-bit aligned offset.  This 
 padding may be omitted after the last message.
 
 Packet layout:
 
    Packet Header
      16-bit cookie 0xC0B7
      16-bit sequence number
    
    DMX buffer broadcast message
      8-bit message type 0xC9
      8-bit source buffer id
      16-bit message length (of entire message, except padding)
      16-bit channel offset
      n bytes of data, where n = message length - 6
      
      
    Messages other than DMX buffer broadcasts are ignored
 
| 
Constructor Summary | 
UdpPacketParser(org.apache.log4j.Logger logger,
                byte[] bytes,
                int length)
 
          Constructs a new parser. | 
 
 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
UdpPacketParser
public UdpPacketParser(org.apache.log4j.Logger logger,
                       byte[] bytes,
                       int length)
- Constructs a new parser.
- Parameters:
 destination - for log messagesbytes - the UDP packet bytes to be interpretedlength - the number of bytes in the bytes buffer
 
getPacket
public UdpPacket getPacket()
- Gets the packet.
- Returns:
 - the packet, or null if no valid packet was found