Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

packet.h File Reference


Detailed Description

G2 packet parser / constructor.

Author:
Jeroen Asselman
Date:
2004

#include <glib.h>

Go to the source code of this file.

Data Structures

struct  g2packet_s

Typedefs

typedef g2packet_s g2packet_t

Functions

g2packet_t * g2_new_packet ()
 G2 New Packet.

void g2_free_packet (g2packet_t *packet)
 G2 free 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.

char * g2_packet_pack (g2packet_t *packet, int *length)


Typedef Documentation

typedef struct g2packet_s g2packet_t
 


Function Documentation

void g2_free_packet (  g2packet_t *  packet  ) 
 

G2 free packet.

Frees a g2 packet and any associated memory. This will also free a payload assigned.

g2packet_t* g2_new_packet (   ) 
 

G2 New Packet.

Creates a new G2 packet.

void g2_packet_add_child (  g2packet_t *  packet,
g2packet_t *  child
) 
 

Add child to packet.

Adds a child packet to the packet. Do _not_ add child packets after adding a payload.

Parameters:
packet is a pointer to the packet to which the child should be added.
child is a pointer to the packet to add.

void g2_packet_add_payload (  g2packet_t *  packet,
char *  payload,
int  length
) 
 

G2 Packet add payload.

Adds a payload to the current packet. After this do _NOT_ add children anymore.

Parameters:
packet is a pointer to the packet to which the payload should be added.
payload is a pointer to the payload which will be added to the packet.
length is the length of the payload to add.

char* g2_packet_get_name (  g2packet_t *  packet  ) 
 

Get the packet name.

Retreives the name of the packet.

Returns:
a name string.

g2packet_t* g2_packet_get_next_child (  g2packet_t *  basepacket  ) 
 

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.

Returns:
the child packet or NULL if no (more) child packets are available.

char* g2_packet_get_payload (  g2packet_t *  packet,
int *  length
) 
 

Get payload.

After this it isn't possible anymore to retreive any children. As it will fast skip them

char* g2_packet_pack (  g2packet_t *  packet,
int *  length
) 
 


Generated on Sun Feb 12 10:50:05 2006 for Gtk-Gnutella by doxygen 1.3.6