selective_repeat.h
Go to the documentation of this file.
#ifndef SELECTIVE_REPEAT_H
#define SELECTIVE_REPEAT_H
#include <itpp/base/vec.h>
#if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !(defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS)))
#ifndef ITPP_PROTOCOL_EXCLUDED
#define ITPP_PROTOCOL_EXCLUDED
#pragma message( "PROTOCOL definitions are not available for MSVC shared builds" )
#endif
#else
#include <itpp/protocol/packet.h>
#include <itpp/protocol/front_drop_queue.h>
#include <itpp/base/array.h>
namespace itpp
{
class Selective_Repeat_ARQ_Sender
{
public:
Selective_Repeat_ARQ_Sender();
Selective_Repeat_ARQ_Sender(const int Seq_no_size, const int Buffer_size_factor, const int Link_packet_size, const Ttype Time_out);
~Selective_Repeat_ARQ_Sender();
void set_parameters(const int Seq_no_size, // # bits in sequence no.
const int Buffer_size_factor, // Link-packet buffer size = 2^(Seq_no_size)*Buffer_size_factor.
const int Link_packet_size, // Size of the link packets in bytes.
const Ttype Time_out); // Idle time before retransmission.
// -- Slots -- //
Slot<Selective_Repeat_ARQ_Sender, Packet*> packet_input;
Slot<Selective_Repeat_ARQ_Sender, Array<Packet*> > ack_input;
Slot<Selective_Repeat_ARQ_Sender, void*> query_nof_ready_packets;
Slot<Selective_Repeat_ARQ_Sender, int> packet_output_request;
// -- Signals -- //
Signal<Array<Packet*> > packet_output;
Signal<int> nof_ready_packets;
Signal<int> buffer_overflow;
int buffer_size();
int link_packets_buffered();
int nof_ready_link_packets();
int link_packets_queued_waiting_for_transmission();
Ttype link_packets_max_queuing_time();
void get_link_packets(const int K, Array<Packet*> &pa);
private:
void handle_ack_input(Array<Packet*> packet_array); // Take care of incomming ack/nacks.
void handle_packet_input(Packet *P); // Take care of incomming packets.
void handle_packet_output_request(int K); // Take care of incomming packet requests.
void handle_query_nof_ready_packets(void*); // Take care of incomming query for number of packets ready to transmit.
void retransmit(int Sequence_number); // Take care of incomming query for number of packets ready to transmit.
void remove(const int Sequence_number);
void push_packet_on_tx_buffer(Packet *packet);
int buffered_non_outstanding();
int free_sequence_numbers();
int sequence_number_2_buffer_index(const int Sequence_number);
void schedule_output(const int Buffer_index, const int Sequence_number, const bool Retransmission);
void cancel_output(const int Sequence_number);
void fill_output();
int feasable_blocks();
bool parameters_ok;
Front_Drop_Queue ip_pkt_queue;
Array<Link_Packet*> input_buffer;
int input_buffer_size;
int input_next;
int input_free_space;
int seq_no_size;
int seq_no;
int seq_no_max;
int tx_next;
int tx_last;
int outstanding;
int id;
Ttype time_out;
Array<ATimer<Selective_Repeat_ARQ_Sender, int> > timer;
ivec output_indexes;
ivec retransmission_indexes;
int rd_pos;
int rt_pos;
int scheduled_total;
int scheduled_retransmissions;
int no_retransmit;
int link_packet_size;
};
class Selective_Repeat_ARQ_Receiver
{
public:
Selective_Repeat_ARQ_Receiver();
Selective_Repeat_ARQ_Receiver(const int Seq_no_size);
~Selective_Repeat_ARQ_Receiver();
// -- Slots -- //
Slot<Selective_Repeat_ARQ_Receiver, Array<Packet*> > packet_input;
// -- Signals -- //
Signal<Array<Packet*> > ack_output;
Signal<Packet*> packet_output;
void set_parameters(const int Seq_no_size); // # bits in sequence no.
private:
bool greater_modulo_L(const int a, const int b);
void handle_packet_input(Array<Packet*>); // Take care of incomming packets.
int seq_no_size;
int seq_no_max;
Array<Link_Packet*> rx_buffer;
int Rnext;
int id;
bool parameters_ok;
};
} // namespace itpp
#endif
#endif // #ifndef SELECTIVE_REPEAT_H
array.h
Definition of Array class (container)
itpp::Array
General array class.
Definition array.h:105
itpp::Front_Drop_Queue
ADD DOCUMENTATION HERE.
Definition front_drop_queue.h:57
itpp::Packet
Definition packet.h:56
itpp::Selective_Repeat_ARQ_Receiver
Definition selective_repeat.h:144
itpp::Selective_Repeat_ARQ_Receiver::Selective_Repeat_ARQ_Receiver
Selective_Repeat_ARQ_Receiver()
ADD DOCUMENTATION HERE.
itpp::Selective_Repeat_ARQ_Receiver::packet_input
Slot< Selective_Repeat_ARQ_Receiver, Array< Packet * > > packet_input
Receives incoming packets.
Definition selective_repeat.h:156
itpp::Selective_Repeat_ARQ_Receiver::ack_output
Signal< Array< Packet * > > ack_output
Delivers ack.
Definition selective_repeat.h:159
itpp::Selective_Repeat_ARQ_Receiver::~Selective_Repeat_ARQ_Receiver
~Selective_Repeat_ARQ_Receiver()
ADD DOCUMENTATION HERE.
itpp::Selective_Repeat_ARQ_Receiver::Selective_Repeat_ARQ_Receiver
Selective_Repeat_ARQ_Receiver(const int Seq_no_size)
ADD DOCUMENTATION HERE.
itpp::Selective_Repeat_ARQ_Receiver::set_parameters
void set_parameters(const int Seq_no_size)
ADD DOCUMENTATION HERE.
itpp::Selective_Repeat_ARQ_Receiver::packet_output
Signal< Packet * > packet_output
Delivers received packets.
Definition selective_repeat.h:160
itpp::Selective_Repeat_ARQ_Sender
Definition selective_repeat.h:58
itpp::Selective_Repeat_ARQ_Sender::nof_ready_packets
Signal< int > nof_ready_packets
Delivers no ready packets.
Definition selective_repeat.h:83
itpp::Selective_Repeat_ARQ_Sender::Selective_Repeat_ARQ_Sender
Selective_Repeat_ARQ_Sender(const int Seq_no_size, const int Buffer_size_factor, const int Link_packet_size, const Ttype Time_out)
ADD DOCUMENTATION HERE.
itpp::Selective_Repeat_ARQ_Sender::buffer_size
int buffer_size()
ADD DOCUMENTATION HERE.
itpp::Selective_Repeat_ARQ_Sender::ack_input
Slot< Selective_Repeat_ARQ_Sender, Array< Packet * > > ack_input
Receives incoming ack/nacks.
Definition selective_repeat.h:77
itpp::Selective_Repeat_ARQ_Sender::packet_output
Signal< Array< Packet * > > packet_output
Delivers transmitted packets.
Definition selective_repeat.h:82
itpp::Selective_Repeat_ARQ_Sender::link_packets_buffered
int link_packets_buffered()
ADD DOCUMENTATION HERE.
itpp::Selective_Repeat_ARQ_Sender::get_link_packets
void get_link_packets(const int K, Array< Packet * > &pa)
ADD DOCUMENTATION HERE.
itpp::Selective_Repeat_ARQ_Sender::packet_input
Slot< Selective_Repeat_ARQ_Sender, Packet * > packet_input
Receives incoming packets.
Definition selective_repeat.h:76
itpp::Selective_Repeat_ARQ_Sender::nof_ready_link_packets
int nof_ready_link_packets()
ADD DOCUMENTATION HERE.
itpp::Selective_Repeat_ARQ_Sender::Selective_Repeat_ARQ_Sender
Selective_Repeat_ARQ_Sender()
ADD DOCUMENTATION HERE.
itpp::Selective_Repeat_ARQ_Sender::link_packets_queued_waiting_for_transmission
int link_packets_queued_waiting_for_transmission()
ADD DOCUMENTATION HERE.
itpp::Selective_Repeat_ARQ_Sender::packet_output_request
Slot< Selective_Repeat_ARQ_Sender, int > packet_output_request
Receives incoming packet output requests.
Definition selective_repeat.h:79
itpp::Selective_Repeat_ARQ_Sender::query_nof_ready_packets
Slot< Selective_Repeat_ARQ_Sender, void * > query_nof_ready_packets
Receives incoming query for number of packets ready to transmit.
Definition selective_repeat.h:78
itpp::Selective_Repeat_ARQ_Sender::~Selective_Repeat_ARQ_Sender
~Selective_Repeat_ARQ_Sender()
ADD DOCUMENTATION HERE.
itpp::Selective_Repeat_ARQ_Sender::buffer_overflow
Signal< int > buffer_overflow
Signals buffer overflows.
Definition selective_repeat.h:84
itpp::Selective_Repeat_ARQ_Sender::set_parameters
void set_parameters(const int Seq_no_size, const int Buffer_size_factor, const int Link_packet_size, const Ttype Time_out)
ADD DOCUMENTATION HERE.
itpp::Selective_Repeat_ARQ_Sender::link_packets_max_queuing_time
Ttype link_packets_max_queuing_time()
ADD DOCUMENTATION HERE.
front_drop_queue.h
Definitions of a Front Drop Queue class.
itpp
itpp namespace
Definition itmex.h:37
packet.h
Definition of a Packet class.
vec.h
Templated Vector Class Definitions.

Generated on Mon Jun 10 2024 11:49:24 for IT++ by Doxygen 1.9.8