Dependencies:
NetServices
Dependents:
HvZ
net/udp.h
- Committer:
- etherealflaim
- Date:
- 2010-12-12
- Revision:
- 0:7e2eb93442e7
File content as of revision 0:7e2eb93442e7:
#ifndef UDP_H
#define UDP_H
#include "net.h"
/**
\file udp.h
\brief UDP packet
This file contains the memory map and associated functions for UDP packet
creation and deconstruction.
*/
#define IPPROTO_UDP 0x11
#define HVZ_PORT 4489
#define HVZ_HOSTNAME "kylelemons.net"
/// UDP Packet memory map
typedef struct {
u16 source_port; ///< Source port (1-65535)
u16 destination_port; ///< Destination port (1-65535)
u16 length; ///< Entire datagram size in bytes
u16 checksum; ///< Checksum
u8 data[]; ///< Data memory map
} UDP_Packet;
/// Convert from wire to host or host to wire endianness
inline void fix_endian_udp(UDP_Packet *segment)
{
fix_endian_u16(&segment->source_port);
fix_endian_u16(&segment->destination_port);
fix_endian_u16(&segment->length);
}
#endif