/* * Active Router Transport Protocol (ARTP) implementation * Copyright (c) 2004, Tomas Rebok * All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the "BSD License" which is * distributed with the software in the file LICENSE. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the BSD * License for more details. */ /** @file * @c ARTP structures for storing session information. * @author Tomas Rebok * @date 2004 */ #ifndef ARTP_STRUCTS_H #define ARTP_STRUCTS_H 1 #include #include #include #include #include #include #include "types.h" #include "net.h" #include "options.h" /** Enumeration of available session status states. */ enum Tsession_status { /** connection lives */ LIVE, /** connection lost */ DEAD }; /** Enumeration of available session types */ enum Tsession_type { /** non-established session */ NON_EST, /** established session */ EST }; /** Structure for undeliverable sessions. * This structure is used to store sessions whose initial packets cannot be * delivered. */ struct dead_zero_sessions { /** session identification number */ SID_TYPE sid; /** session's receiver */ union artp_receiver receiver; /** slipper sign */ int invalid; /** next item in this structure */ struct dead_zero_sessions *next; }; /** Structure for storing session information. */ struct session_item { /** session identification number */ SID_TYPE session_sid; /** session's receiver */ union artp_receiver session_receiver; /** next packet sequence number */ SEQ_TYPE current_seq; /** the identification number of session buffers */ int buffers_id; /** session status */ enum Tsession_status session_status; /** session type */ enum Tsession_type session_type; /** options which this session sends */ void *options[OPTIONS_COUNT]; /** options which this session receives */ void *partner_options[OPTIONS_COUNT]; /** session congestion window size */ unsigned long int cwnd; /** the size of unacknowledged packets for this session */ unsigned long int flight; /** current maximal segment size */ MSS_TYPE mss; /** current maximal acks count */ unsigned int max_acks_count; /** current maximal send buffer size */ unsigned long int sbuffer_max_size; /** current maximal receive buffer size */ unsigned long int rbuffer_max_size; /** current R.E.D. limit */ unsigned long int rbuffer_red_limit; /** current R.E.D. dropping probability */ int rbuffer_red_prob; /** current session round trip time */ double rtt; /** current sessin smooth round trip time */ double srtt; /** current retransmit timeout */ double rto; /** current difference between session's time and its partner's time */ double ts_delta; /** maximal retries timeout for session */ RETR_TIMEOUT_TYPE retries_timeout; /** packets expiration time that belong to this session */ TS_TYPE expiration_time; /** last link activity time */ double last_send_time; /** session reference counter */ unsigned int ref_counter; /** mutex used for mutual exclusion of threads changing reference counter */ pthread_mutex_t ref_counter_mutex; /** mutex used for mutual exclusion of threads changing some session * critical parameters. */ pthread_mutex_t session_mutex; }; #endif /* vim: set ts=4 : */