![]() |
![]() |
![]() |
GSK Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
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_src_address (GskPacket *packet, GskSocketAddress *address); void gsk_packet_set_dst_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 two GskSocketAddress to denote the source and destination of the packet.
typedef struct { /*< public: readonly >*/ gpointer data; guint len; GskSocketAddress *src_address; GskSocketAddress *dst_address; GskPacketDestroyFunc destroy; gpointer destroy_data; } GskPacket;
A packet of binary data, optionally associated with a particular host.
gpointer |
the raw binary data. |
guint |
length of the raw data. |
GskSocketAddress * |
|
GskSocketAddress * |
|
GskPacketDestroyFunc |
destroy notification. |
gpointer |
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.
|
as passed to gsk_packet_new()
|
|
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.
|
binary data in the packet |
|
length of binary data |
|
method to destroy the 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.
|
binary data to be copied into the packet |
|
length of binary data |
Returns : |
a new GskPacket |
void gsk_packet_set_src_address (GskPacket *packet, GskSocketAddress *address);
Change the source address associated with a packet. This should be the address of the interface the packet was sent from.
|
a packet whose source address should be changed. |
|
the new address. |
void gsk_packet_set_dst_address (GskPacket *packet, GskSocketAddress *address);
Change the destination address associated with a packet. This should be the address of the interface the packet was sent to.
|
a packet whose destination address should be changed. |
|
the new address. |
void gsk_packet_unref (GskPacket *packet);
Remove a reference-count from the packet, deleting the packet if it gets to 0.
|
a packet to remove a reference from. |