Panda3D
Public Member Functions
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.

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 37 of file datagramUDPHeader.h.


Constructor & Destructor Documentation

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

Definition at line 29 of file datagramUDPHeader.cxx.

References Datagram::add_uint16(), Datagram::get_length(), and Datagram::get_message().

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 49 of file datagramUDPHeader.cxx.


Member Function Documentation

Returns the checksum appropriate for the indicated datagram.

Definition at line 23 of file datagramUDPHeader.I.

References DatagramIterator::get_uint16().

Referenced by verify_datagram().

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 36 of file datagramUDPHeader.I.

References Datagram::get_message().

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 60 of file datagramUDPHeader.cxx.

References Datagram::dump_hex(), get_datagram_checksum(), and Datagram::get_message().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations