Panda3D
datagramTCPHeader.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file datagramTCPHeader.h
10  * @author drose
11  * @date 2000-02-08
12  */
13 
14 #ifndef DATAGRAMTCPHEADER_H
15 #define DATAGRAMTCPHEADER_H
16 
17 #include "pandabase.h"
18 
19 #include "netDatagram.h"
20 
21 #include "datagramIterator.h"
22 #include "numeric_types.h"
23 
24 static const int datagram_tcp16_header_size = sizeof(uint16_t);
25 static const int datagram_tcp32_header_size = sizeof(uint32_t);
26 
27 class NetDatagram;
28 
29 /**
30  * A class that encapsulates the extra bytes that are sent in front of each
31  * datagram to identify it when it is sent on TCP. This is similar to
32  * DatagramUDPHeader, except it does not include a checksum, since this is
33  * unnecessary on UDP.
34  */
35 class EXPCL_PANDA_NET DatagramTCPHeader {
36 public:
37  DatagramTCPHeader(const NetDatagram &datagram, int header_size);
38  DatagramTCPHeader(const void *data, int header_size);
39 
40  int get_datagram_size(int header_size) const;
41  INLINE std::string get_header() const;
42 
43  bool verify_datagram(const NetDatagram &datagram, int header_size) const;
44 
45 private:
46  // The actual data for the header is stored (somewhat recursively) in its
47  // own NetDatagram object. This is just for convenience of packing and
48  // unpacking the header.
49  NetDatagram _header;
50 };
51 
52 #include "datagramTCPHeader.I"
53 
54 #endif
netDatagram.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
numeric_types.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
datagramTCPHeader.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
NetDatagram
A specific kind of Datagram, especially for sending across or receiving from a network.
Definition: netDatagram.h:40
datagramIterator.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
DatagramTCPHeader
A class that encapsulates the extra bytes that are sent in front of each datagram to identify it when...
Definition: datagramTCPHeader.h:35