Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

artp.h File Reference

#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "packet.h"
#include "options.h"
#include "errors.h"

Go to the source code of this file.

Defines

#define ARTP_H   1

Enumerations

enum  artp_session_params {
  RETRIES_TIMEOUT, MSS, EXP_TIME, MAX_ACKS_COUNT,
  MAX_SBUFFER_SIZE, MAX_RBUFFER_SIZE, MAX_RBUFFER_RED_LIMIT, MAX_RBUFFER_RED_PROBABILITY
}

Functions

int artp_init (int sckt, char *filename)
int artp_prepare_connection (SID_TYPE sid, struct sockaddr *receiver)
int artp_destroy_connection (SID_TYPE sid, struct sockaddr *receiver)
int artp_send_dgram (struct artp_dgram *dgram, SID_TYPE sid, struct sockaddr *receiver)
int artp_receive_dgram (SID_TYPE sid, struct sockaddr *sender, struct artp_dgram *dgram)
int artp_receive_any_dgram (SID_TYPE *sid, struct sockaddr **sender, struct artp_dgram *dgram)
int artp_free_dgram (struct artp_dgram *dgram)
int artp_get_undlvr_session (SID_TYPE *sid, struct sockaddr *receiver)
int artp_get_sid (struct sockaddr *receiver, SID_TYPE *sid)
int artp_set_session_options (SID_TYPE sid, struct sockaddr *receiver, int use, enum artp_session_options option,...)
int artp_set_session_params (SID_TYPE sid, struct sockaddr *sender, enum artp_session_params param,...)


Detailed Description

Active router transport protocol's (ARTP) main library.
Author:
Tomas Rebok
Date:
2004

Enumeration Type Documentation

enum artp_session_params
 

Available session's parameters (which could be set by application)

Enumeration values:
RETRIES_TIMEOUT  maximal retries timeout Defines the maximal retries timeout for each packet -- when acknowledgement doesn't come until this time is reached, session is said to be dead. (in seconds)
MSS  maximal segment size Maximal size of packet that could be sent to the network. (in bytes)
EXP_TIME  expiration time The expiration time for all sent packets. (in microseconds)
MAX_ACKS_COUNT  maximal seq. numbers count (in acks) Defines the maximal count of sequence numbers that could be sent in one ack packet.
MAX_SBUFFER_SIZE  maximal send buffer size Maximal size that could be occupied by send buffer. If it's set to 0, buffer size is unlimited. (in bytes)
MAX_RBUFFER_SIZE  maximal receive buffer size Maximal size that could be occupied by receive buffer. If it's set to 0, buffer size is unlimited. (in bytes)
MAX_RBUFFER_RED_LIMIT  maximal receive buffer R.E.D. limit The receive buffer size when random early detection (R.E.D.) takes place. Every incoming packet is then dropped by defined probability. If it's set to 0 and buffer size is limited, buffer's behavior is like normal tail drop buffer.
MAX_RBUFFER_RED_PROBABILITY  maximal receive buffer R.E.D. probability of packet's dropping Each incoming packet is dropped by this probability (if R.E.D. buffer is used.


Function Documentation

int artp_destroy_connection SID_TYPE    sid,
struct sockaddr *    receiver
 

Destroy session. This function destroys previously created session (all its structures and buffers are destroyed, too). This session destroying is made like a garbage collector - each session knows the count of pointers that points to it. When this count is equal to 0, the session is deleted.

Parameters:
sid  session identification number of deleted session
receiver  the pointer to the place where destroying session's receiver is stored
Returns:
zero success.
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int artp_free_dgram struct artp_dgram   dgram
 

Free ARTP datagram. This function unallocates space taken by ARTP dgram (the space where points ARTP dgram pointers).

Parameters:
dgram  the pointer to the space where ARTP dgram is stored
Returns:
zero success.
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int artp_get_sid struct sockaddr *    receiver,
SID_TYPE *    sid
 

Get available session identification number. This function finds out available session identification number for given receiver.

Parameters:
receiver  the pointer to the place where receiver address is stored
sid  the pointer to the place where found 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 artp_get_undlvr_session SID_TYPE *    sid,
struct sockaddr *    receiver
 

Get undeliverable session. This function returns the non-established session whose packet couldn't be sent.

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

int artp_init int    sckt,
char *    filename
 

Initialize ARTP library. This function makes necessary initialization steps for proper function of ARTP protocol (starts threads, buffers and other structures initialization, etc.). It MUST be called as a first function! (Before any using of this protocol).

Parameters:
sckt  socket where this protocol should listen on.
filename  the name of a config file (or NULL if no config file is required).
Returns:
zero success.
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int artp_prepare_connection SID_TYPE    sid,
struct sockaddr *    receiver
 

Prepare new connection. This function prepares new connection to be established (all necessary structures and buffers are created). Then this new session is inserted to its right position in array of pointers to sessions.

Parameters:
sid  session identification number of creating session.
receiver  the pointer to the place where new session's receiver is stored
Returns:
zero success.
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int artp_receive_any_dgram SID_TYPE *    sid,
struct sockaddr **    sender,
struct artp_dgram   dgram
 

Receive ARTP datagram from non-established sessions. This function receives ARTP dgram from non-established session.

Parameters:
sid  the pointer to the place where session identification number could be stored
sender  the relevant pointer which will be moved to the place where the dgram sender is stored.
dgram  the pointer to the place where ARTP dgram information could be saved.
Returns:
zero success.
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int artp_receive_dgram SID_TYPE    sid,
struct sockaddr *    sender,
struct artp_dgram   dgram
 

Receive ARTP datagram from established sessions. This function receives ARTP datagram from given sender (sent through given session). This session must be previously established.

Parameters:
sid  session identification number
sender  the pointer to the place where session's sender/receiver is stored
dgram  the pointer to the place where ARTP dgram information could be saved.
Returns:
zero success.
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int artp_send_dgram struct artp_dgram   dgram,
SID_TYPE    sid,
struct sockaddr *    receiver
 

Send ARTP datagram. This function sends ARTP datagram to specified receiver through given session. It creates packet header and copies there its payload (the payload is fragmented if necessary). Then it's stored to proper session buffer.

Parameters:
dgram  the pointer to the sending datagram.
sid  session identification number
receiver  the pointer to the place where session receiver is stored
Returns:
zero success.
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int artp_set_session_options SID_TYPE    sid,
struct sockaddr *    receiver,
int    use,
enum artp_session_options    option,
...   
 

Set session options. This function sets defined session options. The option value is taken from variable options list (there's taken the first one only). By proper parameter we can say if we want to use this option or not.

Parameters:
sid  the identification number of proper session
receiver  the pointer to the place where session's receiver is stored
use  indicates whether we have to use this option or not. (0 = do not use, 1 = use)
option  the option identifier that we want to set
...  option value
Returns:
zero success.
Returns:
nonzero related error code if something failed (for further information see documentation of file errors.h).

int artp_set_session_params SID_TYPE    sid,
struct sockaddr *    sender,
enum artp_session_params    param,
...   
 

Set session parameters. This function sets defined session parameters. The parameter value is taken from variable options list (there's taken the first one only).

Parameters:
sid  the identification number of proper session
receiver  the pointer to the place where session's receiver is stored
param  the parameter identifier that we want to set
...  parameter value
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