Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

rbuffers.h File Reference

#include <netinet/in.h>
#include <sys/socket.h>
#include "packet.h"

Go to the source code of this file.

Defines

#define ARTP_RBUFFERS_H   1

Functions

int rbuffers_init (void)
int rbuffers_create (int id_buffer)
int rbuffers_destroy (int id_buffer)
int rbuffers_get_size (int id_buffer, unsigned long int *buffer_size)
int rbuffers_add_packet (int id_buffer, char *value, int payload_size, struct sockaddr *sender, SID_TYPE sid, enum packet_type type, SEQ_TYPE seq, DSEQ_TYPE dseq, FRAGMENTS_TYPE frag_id, FRAGMENTS_TYPE frag_count, double current_time, unsigned int retransmits_timeout)
int rbuffers_get_dgram (int id_buffer, char **value, int *size, enum packet_type *type, DSEQ_TYPE *dseq, struct sockaddr **sender, SID_TYPE *sid)


Detailed Description

ARTP library for receive buffers.
Author:
Tomas Rebok
Date:
2004

Function Documentation

int rbuffers_add_packet int    id_buffer,
char *    value,
int    payload_size,
struct sockaddr *    sender,
SID_TYPE    sid,
enum packet_type    type,
SEQ_TYPE    seq,
DSEQ_TYPE    dseq,
FRAGMENTS_TYPE    frag_id,
FRAGMENTS_TYPE    frag_count,
double    current_time,
unsigned int    retransmits_timeout
 

Add incoming packet payload into receive buffer. This function adds packet payload into receive buffer. If the whole datagram consists of 1 fragment, it's immediately saved into complete datagrams buffer. If that datagram consists of more than one fragment, the packet is saved into incomplete datagrams buffer. After coming of the last fragment the whole datagram is moved to complete datagrams buffer.

Parameters:
id_buffer  identification number of receive buffer.
value  the pointer to the place where the packet payload is stored.
payload_size  payload size of adding packet.
sender  the pointer to the place where the information about packet's sender is stored (used for non-established sessions).
sid  session identification number
type  packet type
seq  packet sequence number
dseq  packet data sequence (or arbitrary value if adding control packet).
frag_id  data datagram fragment identification number (if adding control packet, it MUST be set to 1).
frag_count  data datagram fragments count (if adding control packet, it MUST be set to 1).
current_time  current time (it's equal to packet incoming time)
retransmits_timeout  retransmits_timeout sent by our partner to determine old packets in structure for duplicity check. Set it to 0 if our partner doesn't send this option.
Returns:
zero success
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int rbuffers_create int    id_buffer
 

Create receive buffer. This function allocates place for relevant buffer and initializes its parameters.

Parameters:
id_buffer  identification number of creating buffer.
Returns:
zero success
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int rbuffers_destroy int    id_buffer
 

Destroy receive buffer. This function destroys relevant receive buffer. It unallocates place used by that buffer and makes some other clearing steps (deletes all completely and incompletely received datagrams, destroys all its structures, etc.).

Parameters:
id_buffer  identification number of destroyed buffer.
Returns:
zero success
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int rbuffers_get_dgram int    id_buffer,
char **    value,
int *    size,
enum packet_type   type,
DSEQ_TYPE *    dseq,
struct sockaddr **    sender,
SID_TYPE *    sid
 

Obtain completely received datagram. This functions gets one completely received datagram (if any). If that datagram consists of more than one fragment it will be assembled from all its fragments.

Parameters:
id_buffer  identification number of receive buffer.
value  the relevant pointer which will be moved to the place where the datagram payload will be saved.
size  the pointer to the place where the payload size could be stored.
type  the pointer to the place where the datagram type could be stored.
dseq  the pointer to the place where the payload data sequence number could be stored.
sender  the relevant pointer which will be moved to the place where the datagram's sender is stored.
sid  the pointer to the place where the session identification number could be stored.
Returns:
zero success
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int rbuffers_get_size int    id_buffer,
unsigned long int *    buffer_size
 

Return identified receive buffer size. This function finds out receive buffer size and returns it.

Parameters:
id_buffer  identification number of receive buffer.
buffer_size  the pointer to the place where buffer size could be stored.
Returns:
zero success.
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int rbuffers_init void   
 

Initialize receive buffers. This function doesn't include any code this time. It is defined for further purposes.

Returns:
zero success
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).


Generated on Fri May 21 07:50:25 2004 for Active Router Transport Protocol (ARTP) by doxygen1.2.15