![]() | ![]() | ![]() | GSK Reference Manual | ![]() |
---|
struct GskPacket; void (*GskPacketDestroyFunc) (gpointer destroy_data, GskPacket *packet); GskPacket* gsk_packet_new (gpointer data, guint length, GskPacketDestroyFunc destroy, gpointer destroy_data); GskPacket* gsk_packet_new_copy (gconstpointer data, guint length); void gsk_packet_set_address (GskPacket *packet, GskSocketAddress *address); void gsk_packet_unref (GskPacket *packet); GskPacket* gsk_packet_ref (GskPacket *packet);
A reference-counted binary piece of data with a destroy-notify to allow arbitrary memory management.
It may optionally have a GskSocketAddress to denote the remote host.
struct GskPacket { /*< public: readonly >*/ gpointer data; guint len; GskSocketAddress *address; GskPacketDestroyFunc destroy; gpointer destroy_data; };
A packet of binary data, optionally associated with a particular host.
gpointer data | the raw binary data. |
guint len | length of the raw data. |
GskSocketAddress *address | remote address of this packet. |
GskPacketDestroyFunc destroy | destroy notification. |
gpointer destroy_data | data to invoke destroy on. |
void (*GskPacketDestroyFunc) (gpointer destroy_data, GskPacket *packet);
The actual function prototype of destroy. This is only useful if you want to examine the whole GskPacket from your destroy function.
destroy_data : | as passed to gsk_packet_new() |
packet : | the whole packet. |
GskPacket* gsk_packet_new (gpointer data, guint length, GskPacketDestroyFunc destroy, gpointer destroy_data);
Creates a new packet with the given data. The packet's ref-count is 1; it will be destroyed when it gets to 0.
data : | binary data in the packet |
length : | length of binary data |
destroy : | method to destroy the data. |
destroy_data : | the argument to the destroy method. |
Returns : | a new GskPacket |
GskPacket* gsk_packet_new_copy (gconstpointer data, guint length);
Creates a new packet with a copy of the given data. The packet's ref-count is 1; it will be destroyed when it gets to 0.
data : | binary data to be copied into the packet |
length : | length of binary data |
Returns : | a new GskPacket |
void gsk_packet_set_address (GskPacket *packet, GskSocketAddress *address);
Change the address associated with a packet.
packet : | a packet whose address should be changed. |
address : | the new address. |
void gsk_packet_unref (GskPacket *packet);
Remove a reference-count from the packet, deleting the packet if it gets to 0.
packet : | a packet to remove a reference from. |
<<< Datagram I/O | Listening for Connections >>> |