Creates a packet that may be sent to a peer.
|dataContents ||initial contents of the packet's data; the packet's data will remain uninitialized if dataContents is NULL. |
|dataLength ||size of the data allocated for this packet |
|flags ||flags for this packet as described for the ENetPacket structure. |
- the packet on success, NULL on failure
Definition at line 21 of file packet.c.
ENetPacket * packet = (ENetPacket *) enet_malloc (sizeof (ENetPacket));
packet -> data = (enet_uint8 *) enet_malloc (dataLength);
if (data != NULL)
memcpy (packet -> data, data, dataLength);
packet -> referenceCount = 0;
packet -> flags = flags;
packet -> dataLength = dataLength;