Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

DatagramUDPHeader Class Reference

A class that encapsulates the extra bytes that are sent in front of each datagram to identify it when it is sent on UDP. More...

#include <datagramUDPHeader.h>

List of all members.

Public Member Functions

 DatagramUDPHeader (const NetDatagram &datagram)
 This constructor creates a header based on an already-constructed NetDatagram.

 DatagramUDPHeader (const void *data)
 This constructor decodes a header from a block of data of length datagram_udp_header_size, presumably just read from a socket.

int get_datagram_checksum () const
 Returns the checksum appropriate for the indicated datagram.

string get_header () const
 Returns a pointer to a block of data of length datagram_udp_header_size, which can be written to the network as the header information.

bool verify_datagram (const NetDatagram &datagram) const
 Verifies that the indicated datagram has the appropriate length and checksum.


Private Attributes

NetDatagram _header


Detailed Description

A class that encapsulates the extra bytes that are sent in front of each datagram to identify it when it is sent on UDP.

Like NetDatagram, this class automatically handles converting its data to and from the network byte ordering.

Definition at line 52 of file datagramUDPHeader.h.


Constructor & Destructor Documentation

DatagramUDPHeader::DatagramUDPHeader const NetDatagram datagram  ) 
 

This constructor creates a header based on an already-constructed NetDatagram.

Definition at line 40 of file datagramUDPHeader.cxx.

References DatagramTCPHeader::_header.

DatagramUDPHeader::DatagramUDPHeader const void *  data  ) 
 

This constructor decodes a header from a block of data of length datagram_udp_header_size, presumably just read from a socket.

Definition at line 65 of file datagramUDPHeader.cxx.

References size_t.


Member Function Documentation

int DatagramUDPHeader::get_datagram_checksum  )  const [inline]
 

Returns the checksum appropriate for the indicated datagram.

Definition at line 34 of file datagramUDPHeader.I.

References _header, Datagram::get_message(), and INLINE.

string DatagramUDPHeader::get_header  )  const [inline]
 

Returns a pointer to a block of data of length datagram_udp_header_size, which can be written to the network as the header information.

Definition at line 52 of file datagramUDPHeader.I.

Referenced by Connection::set_keep_alive().

bool DatagramUDPHeader::verify_datagram const NetDatagram datagram  )  const
 

Verifies that the indicated datagram has the appropriate length and checksum.

Returns true if it matches, false otherwise.

Definition at line 81 of file datagramUDPHeader.cxx.


Member Data Documentation

NetDatagram DatagramUDPHeader::_header [private]
 

Definition at line 66 of file datagramUDPHeader.h.

Referenced by get_datagram_checksum().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:49:11 2003 for Panda by doxygen1.3