PhPackEntry()

Pack transport data, given a transport registry entry

Synopsis:

char * PhPackEntry(
          char *buffer,
          PhTransportRegEntry_t *regent,
          char const * const type,
          char const * const desc,
          int unsigned const grouping_num,
          int unsigned const handle,
          int unsigned const request_transport,
          int unsigned const inlined_transport,
          char const * const data,
          int unsigned const size,
          int unsigned *tot_size,
          iov_t *iovs,
          int unsigned *niovs,
          int unsigned *iovsize );

Library:

ph

Description:

This function takes the data referenced by data and packs it into a stream buffer pointed to by buffer.


Note: You're not likely to call this function directly; call PhTransportType() instead.

The arguments to PhPackEntry() are:

buffer
A pointer to the buffer in which to pack the data:
regent
A pointer to the transport registry entry for the type of data to be packed. For more information, see PhTransportRegEntry_t.

If you don't have a pointer to the registry entry for the data to be packed, call PhPackType() instead of PhPackEntry().

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.
request_transport
The available transport types that can be specified when requesting data from the source. This can be any of:
inlined_transport
The transport type used for the inlined data. This can be one of:
data
A pointer to the data to be packed.
size
The size, in bytes, of the data to be packed. This size is used only for raw data.
tot_size
A pointer to a variable in which to store the total size of the buffer. This should be non-NULL if you're calculating the size required for the buffer (i.e. buffer is NULL).
iovs
a pointer to an array of I/O vectors.
niovs
A pointer to a variable in which to store the number of I/O vectors required. This should be non-NULL if you're calculating the size required for the buffer (i.e. buffer is NULL).
iovsize
A pointer to a variable in which to store the size of the I/O vectors required. This should be non-NULL if you're calculating the size required for the buffer (i.e. buffer is NULL).

Returns:

The current position in the buffer after packing the data, or NULL if no data was packed.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PhAllocPackType(), PhFindTransportType(), PhMallocUnpack(), PhPackType(), PhRegisterTransportType(), PhTransportCtrl_t, PhTransportRegEntry_t, PhTransportType(), PhUnpack()

Drag and Drop chapter of the Photon Programmer's Guide