#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "packet.h"
Functions | |
char * | g2_packet_pack (g2packet_t *packet, int *length) |
G2 Packet pack. | |
int | g2_packet_calc_new_length (g2packet_t *packet) |
G2 Packet calculate length/. | |
void | g2_packet2buf (g2packet_t *packet, char *destination) |
G2 Packet2buf. | |
g2packet_t * | g2_new_packet () |
G2 New Packet. | |
void | g2_free_packet (g2packet_t *packet) |
G2 free packet. | |
void | g2_parse_header (char **buffer, g2packet_t *packet) |
g2 parse header. | |
void | g2_parse_packet (char **buffer, g2packet_t *packet) |
G2 Parse packet. | |
char * | g2_packet_get_name (g2packet_t *packet) |
Get the packet name. | |
g2packet_t * | g2_packet_get_next_child (g2packet_t *basepacket) |
Get the next child from the current packet. | |
char * | g2_packet_get_payload (g2packet_t *packet, int *length) |
Get payload. | |
void | g2_packet_add_child (g2packet_t *packet, g2packet_t *child) |
Add child to packet. | |
void | g2_packet_add_payload (g2packet_t *packet, char *payload, int length) |
G2 Packet add payload. | |
int | g2_packet_calc_lenlength (int length) |
Calculate the lenlength field from a given length. |
|
G2 free packet. Frees a g2 packet and any associated memory. This will also free a payload assigned. |
|
G2 New Packet. Creates a new G2 packet. |
|
G2 Packet2buf. In the destination pointer a g2 packet is constructed from the given G2Packet. The destination should be at least the size retreived with g2_packet_calc_new_length(packet). |
|
Add child to packet. Adds a child packet to the packet. Do _not_ add child packets after adding a payload.
|
|
G2 Packet add payload. Adds a payload to the current packet. After this do _NOT_ add children anymore.
|
|
Calculate the lenlength field from a given length.
|
|
G2 Packet calculate length/. Calculates the size that will be used by this G2Packet when transformed to a buffer / char pointer.
|
|
Get the packet name. Retreives the name of the packet.
|
|
Get the next child from the current packet. Retreives the next child packet from the current packet and moves to the next child packet. Next time this function is called the next child packet is returned.
|
|
Get payload. After this it isn't possible anymore to retreive any children. As it will fast skip them |
|
G2 Packet pack. Construct a buffer from a G2Packet and return the newly allocated buffer.
|
|
g2 parse header. Parse the packet header to extract length information. |
|
G2 Parse packet. Parse the g2 packet to retreive the start of the payload/children |