19 #ifndef __NETPACKET_H__ 20 #define __NETPACKET_H__ 22 #include <csutil/csendian.h> 23 #include <csutil/refcount.h> 24 #include <csutil/hash.h> 103 pktid = csLittleEndian::Convert((uint32)pktid);
104 offset = csLittleEndian::Convert((uint32)offset);
105 msgsize = csLittleEndian::Convert((uint32)msgsize);
106 pktsize = csLittleEndian::Convert((uint16)pktsize);
111 pktid = csLittleEndian::UInt32(pktid);
112 offset = csLittleEndian::UInt32(offset);
113 msgsize = csLittleEndian::UInt32(msgsize);
114 pktsize = csLittleEndian::UInt16(pktsize);
130 if (buffer_length < (
int)
sizeof(
struct psNetPacket))
135 if ((
unsigned int)buffer_length < csLittleEndian::Convert(potentialpacket->
pktsize) +
sizeof(
struct psNetPacket))
138 return potentialpacket;
153 PacketKey(uint32_t Clientnum, uint32_t Pktid):clientnum(Clientnum), pktid(Pktid) { };
157 if (clientnum < other.clientnum)
159 if (clientnum > other.clientnum)
162 return (pktid < other.pktid);
204 uint32_t off, uint32_t totalsize, uint16_t sz,
209 uint32_t
id, uint32_t off, uint32_t totalsize, uint16_t sz,
220 csPtr<psNetPacketEntry> GetNextPacket(
psNetPacket* &packetdata);
263 static int Compare(csRef<psNetPacketEntry>
const &r1, csRef<psNetPacketEntry>
const &r2)
265 return csComparator<psNetPacketEntry, psNetPacketEntry>::Compare(*r1, *r2);
static struct psNetPacket * NetPacketFromBuffer(void *buffer, int buffer_length)
psNetPacket * packet
The Packet like it is returned from reading UDP socket / will be written to socket.
psNetPacketEntry(psNetPacketEntry *)
size_t GetPacketSize() const
uint8_t GetPriority() const
uint32_t pktid
each packet must know what message it's a part of this should be 0 in most cases as it's assigned at ...
uint32_t clientnum
clientnum this packet comes from/goes to
MAXPACKETSIZE includes header length ( sizeof(struct psNetPacket) )
psNetPacket gives the networking code the context it needs, and all of this info goes out on the wire...
bool retransmitted
has this packet been retransmitted
uint8_t GetSequence() const
bool IsMultiPacket() const
uint8_t flags
Each packet needs to know its own priority.
char data[0]
this can be used as a pointer to the data
bool operator<(long lhs, const GmpInt &rhs)
PacketKey(uint32_t Clientnum, uint32_t Pktid)
uint32_t offset
offset and size together specify a memory block within the psMessageBytes struct
static int Compare(csRef< psNetPacketEntry > const &r1, csRef< psNetPacketEntry > const &r2)
this struct represents the data that is sent out through the network (all additional stuff should go ...