Logo Search packages:      
Sourcecode: egoboo version File versions  Download package

ENetPacket* enet_packet_create ( const void *  data,
size_t  dataLength,
enet_uint32  flags 

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;

    return packet;

Generated by  Doxygen 1.6.0   Back to index