/* BlueDataDistributor - data distribution module from ethernet to 32 serial ports
 * version 0.1.1 date 2006-10-07
 * Copyright (C) 2006 Stefan Schuermans <stefan@blinkenarea.org>
 * a BlinkenArea project - http://www.blinkenarea.org/
 */

#ifndef INC_udp
#define INC_udp

#include "ethernet.h"
#include "ip.h"

// header of an UDP packet
struct UdpHeader
{
  unsigned int SrcPort;
  unsigned int DestPort;
  unsigned int Length;
  unsigned int Chk;
};

// an UDP packet
struct UdpPacket
{
  struct EthernetHeader EthHdr;
  struct IpHeader IpHdr;
  struct UdpHeader UdpHdr;
};

// tick procedure - call every 200ms
extern void UdpTick200( void );

// process a received UDP packet
extern void UdpRecv( unsigned char * pData, unsigned short Length );

// send an UDP packet
// pData must point to a struct UdpPacket with UdpHdr.SrcPort, UdpHdr.DestPort and IpHdr.Dest already initialized
extern void UdpSend( unsigned char * pData, unsigned short Length );

#endif // #ifdef INC_udp

