00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef NETDATAGRAM_H
00016 #define NETDATAGRAM_H
00017
00018 #include "pandabase.h"
00019
00020 #include "connection.h"
00021 #include "netAddress.h"
00022
00023 #include "datagram.h"
00024 #include "pointerTo.h"
00025
00026 #include <string>
00027
00028
00029
00030
00031
00032
00033
00034 static const int maximum_udp_datagram = 1500;
00035
00036
00037
00038
00039
00040
00041
00042
00043 class EXPCL_PANDA_NET NetDatagram : public Datagram {
00044 PUBLISHED:
00045 NetDatagram();
00046 NetDatagram(const void *data, size_t size);
00047 NetDatagram(const Datagram ©);
00048 NetDatagram(const NetDatagram ©);
00049 void operator = (const Datagram ©);
00050 void operator = (const NetDatagram ©);
00051
00052 virtual void clear();
00053
00054 void set_connection(const PT(Connection) &connection);
00055 PT(Connection) get_connection() const;
00056
00057 void set_address(const NetAddress &address);
00058 const NetAddress &get_address() const;
00059
00060 public:
00061
00062
00063
00064 INLINE bool operator == (const NetDatagram &other) const;
00065 INLINE bool operator != (const NetDatagram &other) const;
00066 INLINE bool operator < (const NetDatagram &other) const;
00067
00068 private:
00069 PT(Connection) _connection;
00070 NetAddress _address;
00071
00072
00073 public:
00074 static TypeHandle get_class_type() {
00075 return _type_handle;
00076 }
00077 static void init_type() {
00078 Datagram::init_type();
00079 register_type(_type_handle, "NetDatagram",
00080 Datagram::get_class_type());
00081 }
00082 virtual TypeHandle get_type() const {
00083 return get_class_type();
00084 }
00085 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00086
00087 private:
00088 static TypeHandle _type_handle;
00089 };
00090
00091 #include "netDatagram.I"
00092
00093 #endif