PhAllocPackType()

Allocate a buffer and pack transport data into it

Synopsis:

char * PhAllocPackType( char unsigned *type,
                        char unsigned *desc,
                        int unsigned grouping_num,
                        int unsigned handle,
                        int unsigned transport,
                        char *packing_type,
                        char unsigned *data,
                        int unsigned len,
                        int *size );

Arguments:

type
A descriptive type name, such as image, text, filename, or files. This is simply added to the header for the packed data.
desc
The specifics of what's in the data. The extractor uses a regular-expression match against the description to determine if the data should be unpacked or discarded. This is simply added to the header for the packed data.
grouping_num
When used with Photon's drag and drop mechanism, the grouping_num is used to indicate which stream is just a different representation of other data also packed into the same PhTransportCtrl_t structure. Only one of each grouping_num should be unpacked by the reader/destination.

This value is simply added to the header for the packed data.

handle
A number that you can use to identify a transaction. This is simply added to the header for the packed data.
transport
The transport type used for the inlined data. This can be one of:
packing_type
The name of the entry in the transport registry to be used to pack the data. For more information, see PhTransportRegEntry_t. If you already have a pointer to the registry entry, you can call PhPackEntry() instead of PhPackType().
data
A pointer to the data to be packed.
len
The size, in bytes, of the data to be packed. This size is used only for raw data.
size
If this argument isn't NULL, the size of the allocated buffer is stored in the memory it points to.

Library:

ph

Description:

This function allocates a buffer big enough to hold the packed version of the given data, and then packs the data into the buffer.

Returns:

A pointer to the buffer, or NULL if no data was packed.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PhMallocUnpack(), PhPackEntry(), PhPackType(), PhTransportCtrl_t, PhTransportRegEntry_t, PhTransportType(), PhUnpack()

Drag and Drop chapter of the Photon Programmer's Guide