Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

abuffers.h File Reference

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

Go to the source code of this file.

Defines

#define ARTP_ABUFFERS_H   1

Functions

int abuffers_init (void)
int abuffers_create (int id_buffer, SID_TYPE sid, struct sockaddr *sender)
int abuffers_destroy (int id_buffer)
int abuffers_add_seq (int id_buffer, SID_TYPE sid, struct sockaddr *sender, SEQ_TYPE seq, double latest_send_time, int maximal_count)
int abuffers_get_ack (double time, SID_TYPE *sid, struct sockaddr **receiver, char **value, int *size)


Detailed Description

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

Function Documentation

int abuffers_add_seq int    id_buffer,
SID_TYPE    sid,
struct sockaddr *    sender,
SEQ_TYPE    seq,
double    latest_send_time,
int    maximal_count
 

Store incoming sequence number to relevant buffer. This function adds sequence number of incoming packet to given buffer identified by its id. If it's the first sequence number saving for this session, it inserts the pointer of this session to the right place in structure for sending ack packets (depending on its latest time to send).

Parameters:
id_buffer  the identification number of ack buffer.
sid  the identification number of session that this sequence number relates to (used when this session isn't created).
sender  pointer to the place where the information about actual packet's sender is stored (it's the same as above - used when this session isn't created).
seq  the sequence number that has to be stored.
latest_send_time  the latest time when the ack packet must be sent.
maximal_count  the maximal count of sequence numbers in one ack packet (after reaching this count the ack packet is immediately sent).
Returns:
zero success
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int abuffers_create int    id_buffer,
SID_TYPE    sid,
struct sockaddr *    sender
 

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

Parameters:
id_buffer  the identification number of buffer to be created.
sid  the identification number of session which this buffer will be created for.
sender  pointer to the place where the sender of received packets is stored.
Returns:
zero success
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int abuffers_destroy int    id_buffer
 

Destroy ack buffer. This function destroys relevant ack buffer. It unallocates place used by that buffer and makes some other clearing steps (e.g. removes this buffer from structure for sending ack packets, etc.).

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

int abuffers_get_ack double    time,
SID_TYPE *    sid,
struct sockaddr **    receiver,
char **    value,
int *    size
 

Get next ack packet which should be sent. This function looks whether there's any ack packet which should be sent in specified time. If there's any it returns all information about that packet and removes related buffer from structure for sending ack packets.

Parameters:
time  actual time
sid  the pointer to the place where session's identification number will be stored.
receiver  the relevant pointer which will be moved to the place where the receiver of returned ack packet will be stored.
value  the relevant pointer which will be moved to the place where the payload of returned ack packet will be stored.
size  the pointer to the place where the size of ack packet payload will be stored.
Returns:
zero success
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int abuffers_init void   
 

Initialize ack 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:24 2004 for Active Router Transport Protocol (ARTP) by doxygen1.2.15