IP_MsgCreate

IP_MsgCreate — creates an IP_Msg structure.

Syntax

#include <cogent.h>
IP_Msg* IP_MsgCreate(void*  data,
 int datalen,
 int noresize);

Arguments

data

The initial data in the message, or NULL.

datalen

The length of the allocated data buffer.

noresize

If non-zero, indicates that datalen is fixed.

Returns

A pointer to a new IP_Msg.

Description

This function creates a new IP_Msg structure whose message is an IP_MsgBuffer with a data buffer that is datalen bytes in length.

If data is non-NULL, then datalen bytes are copied into the newly allocated data buffer in the IP_MsgBuffer component of the IP_Msg. If noresize is 0, then the IP library may enlarge the data buffer in the future to accomodate requests larger than datalen. If datalen is 0, then IP_MsgDefaultSize is used. The message is marked as dynamic.

See Also

Messages, IP_MsgDestroy