00001 // Filename: datagramTCPHeader.h 00002 // Created by: drose (08Feb00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef DATAGRAMTCPHEADER_H 00020 #define DATAGRAMTCPHEADER_H 00021 00022 #include "pandabase.h" 00023 00024 #include "netDatagram.h" 00025 00026 #include "datagramIterator.h" 00027 00028 #include <prtypes.h> 00029 00030 static const int datagram_tcp_header_size = sizeof(PRUint16); 00031 00032 class NetDatagram; 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Class : DatagramTCPHeader 00036 // Description : A class that encapsulates the extra bytes that are 00037 // sent in front of each datagram to identify it when it 00038 // is sent on TCP. This is similar to 00039 // DatagramUDPHeader, except it does not include a 00040 // checksum, since this is unnecessary on UDP. 00041 //////////////////////////////////////////////////////////////////// 00042 class EXPCL_PANDA DatagramTCPHeader { 00043 public: 00044 DatagramTCPHeader(const NetDatagram &datagram); 00045 DatagramTCPHeader(const void *data); 00046 00047 INLINE int get_datagram_size() const; 00048 INLINE string get_header() const; 00049 00050 bool verify_datagram(const NetDatagram &datagram) const; 00051 00052 private: 00053 // The actual data for the header is stored (somewhat recursively) 00054 // in its own NetDatagram object. This is just for convenience of 00055 // packing and unpacking the header. 00056 NetDatagram _header; 00057 }; 00058 00059 #include "datagramTCPHeader.I" 00060 00061 #endif 00062 00063