Panda3D

Loading...
Searching...
No Matches
Public Member Functions | List of all members
DatagramTCPHeader 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 TCP. More...

`#include "datagramTCPHeader.h"`

## Public Member Functions
| DatagramTCPHeader (const NetDatagram &datagram, int header_size)
| This constructor creates a header based on an already-constructed NetDatagram.
| DatagramTCPHeader (const void *data, int header_size)
| This constructor decodes a header from a block of data of length datagram_tcp_header_size, presumably just read from a socket.
int | get_datagram_size (int header_size) const
| Returns the number of bytes in the associated datagram.
std::string | get_header () const
| Returns a pointer to a block of data of length datagram_tcp_header_size, which can be written to the network as the header information.
bool | verify_datagram (const NetDatagram &datagram, int header_size) const
| Verifies that the indicated datagram has the appropriate length.

## 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 TCP.

This is similar to DatagramUDPHeader, except it does not include a checksum, since this is unnecessary on UDP.

Definition at line 35 of file datagramTCPHeader.h.

## Constructor & Destructor Documentation

## ◆ DatagramTCPHeader() [1/2]

DatagramTCPHeader::DatagramTCPHeader | ( | const NetDatagram & | datagram,
|  | int | header_size )

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

Definition at line 25 of file datagramTCPHeader.cxx.

References Datagram::get_length().

## ◆ DatagramTCPHeader() [2/2]

DatagramTCPHeader::DatagramTCPHeader | ( | const void * | data,
|  | int | header_size )

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

Definition at line 60 of file datagramTCPHeader.cxx.

## Member Function Documentation

## ◆ get_datagram_size()

int DatagramTCPHeader::get_datagram_size | ( | int | header_size | ) | const

Returns the number of bytes in the associated datagram.

Definition at line 69 of file datagramTCPHeader.cxx.

References DatagramIterator::get_uint16(), and DatagramIterator::get_uint32().

Referenced by verify_datagram().

## ◆ get_header()

std::string DatagramTCPHeader::get_header | ( |  | ) | const
| inline

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

Definition at line 18 of file datagramTCPHeader.I.

## ◆ verify_datagram()

bool DatagramTCPHeader::verify_datagram | ( | const NetDatagram & | datagram,
|  | int | header_size ) const

Verifies that the indicated datagram has the appropriate length.

Returns true if it matches, false otherwise.

Definition at line 90 of file datagramTCPHeader.cxx.

References Datagram::dump_hex(), get_datagram_size(), and Datagram::get_length().

The documentation for this class was generated from the following files:

- panda/src/net/datagramTCPHeader.h
- panda/src/net/datagramTCPHeader.cxx
- panda/src/net/datagramTCPHeader.I