IT++ Logo
selective_repeat.h
Go to the documentation of this file.
1
29#ifndef SELECTIVE_REPEAT_H
30#define SELECTIVE_REPEAT_H
31
32#include <itpp/base/vec.h>
33
34#if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !(defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS)))
35
36#ifndef ITPP_PROTOCOL_EXCLUDED
37#define ITPP_PROTOCOL_EXCLUDED
38#pragma message( "PROTOCOL definitions are not available for MSVC shared builds" )
39#endif
40
41#else
42
45#include <itpp/base/array.h>
46
47
48namespace itpp
49{
50
52
53
58{
59public:
62
65
68
70 void set_parameters(const int Seq_no_size, // # bits in sequence no.
71 const int Buffer_size_factor, // Link-packet buffer size = 2^(Seq_no_size)*Buffer_size_factor.
72 const int Link_packet_size, // Size of the link packets in bytes.
73 const Ttype Time_out); // Idle time before retransmission.
74
75 // -- Slots -- //
80
81 // -- Signals -- //
85
97 void get_link_packets(const int K, Array<Packet*> &pa);
98
99private:
100 void handle_ack_input(Array<Packet*> packet_array); // Take care of incomming ack/nacks.
101 void handle_packet_input(Packet *P); // Take care of incomming packets.
102 void handle_packet_output_request(int K); // Take care of incomming packet requests.
103 void handle_query_nof_ready_packets(void*); // Take care of incomming query for number of packets ready to transmit.
104 void retransmit(int Sequence_number); // Take care of incomming query for number of packets ready to transmit.
105 void remove(const int Sequence_number);
106 void push_packet_on_tx_buffer(Packet *packet);
107 int buffered_non_outstanding();
108 int free_sequence_numbers();
109 int sequence_number_2_buffer_index(const int Sequence_number);
110 void schedule_output(const int Buffer_index, const int Sequence_number, const bool Retransmission);
111 void cancel_output(const int Sequence_number);
112 void fill_output();
113 int feasable_blocks();
114 bool parameters_ok;
115 Front_Drop_Queue ip_pkt_queue;
116 Array<Link_Packet*> input_buffer;
117 int input_buffer_size;
118 int input_next;
119 int input_free_space;
120 int seq_no_size;
121 int seq_no;
122 int seq_no_max;
123 int tx_next;
124 int tx_last;
125 int outstanding;
126 int id;
127 Ttype time_out;
129 ivec output_indexes;
130 ivec retransmission_indexes;
131 int rd_pos;
132 int rt_pos;
133 int scheduled_total;
134 int scheduled_retransmissions;
135 int no_retransmit;
136 int link_packet_size;
137};
138
139
144{
145public:
148
151
154
155 // -- Slots -- //
157
158 // -- Signals -- //
161
163 void set_parameters(const int Seq_no_size); // # bits in sequence no.
164
165private:
166 bool greater_modulo_L(const int a, const int b);
167 void handle_packet_input(Array<Packet*>); // Take care of incomming packets.
168 int seq_no_size;
169 int seq_no_max;
170 Array<Link_Packet*> rx_buffer;
171 int Rnext;
172 int id;
173 bool parameters_ok;
174};
175
177
178} // namespace itpp
179
180#endif
181
182#endif // #ifndef SELECTIVE_REPEAT_H
183
Definition of Array class (container)
General array class.
Definition array.h:105
ADD DOCUMENTATION HERE.
Selective_Repeat_ARQ_Receiver()
ADD DOCUMENTATION HERE.
Slot< Selective_Repeat_ARQ_Receiver, Array< Packet * > > packet_input
Receives incoming packets.
Signal< Array< Packet * > > ack_output
Delivers ack.
~Selective_Repeat_ARQ_Receiver()
ADD DOCUMENTATION HERE.
Selective_Repeat_ARQ_Receiver(const int Seq_no_size)
ADD DOCUMENTATION HERE.
void set_parameters(const int Seq_no_size)
ADD DOCUMENTATION HERE.
Signal< Packet * > packet_output
Delivers received packets.
Signal< int > nof_ready_packets
Delivers no ready packets.
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.
int buffer_size()
ADD DOCUMENTATION HERE.
Slot< Selective_Repeat_ARQ_Sender, Array< Packet * > > ack_input
Receives incoming ack/nacks.
Signal< Array< Packet * > > packet_output
Delivers transmitted packets.
int link_packets_buffered()
ADD DOCUMENTATION HERE.
void get_link_packets(const int K, Array< Packet * > &pa)
ADD DOCUMENTATION HERE.
Slot< Selective_Repeat_ARQ_Sender, Packet * > packet_input
Receives incoming packets.
int nof_ready_link_packets()
ADD DOCUMENTATION HERE.
Selective_Repeat_ARQ_Sender()
ADD DOCUMENTATION HERE.
int link_packets_queued_waiting_for_transmission()
ADD DOCUMENTATION HERE.
Slot< Selective_Repeat_ARQ_Sender, int > packet_output_request
Receives incoming packet output requests.
Slot< Selective_Repeat_ARQ_Sender, void * > query_nof_ready_packets
Receives incoming query for number of packets ready to transmit.
~Selective_Repeat_ARQ_Sender()
ADD DOCUMENTATION HERE.
Signal< int > buffer_overflow
Signals buffer overflows.
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.
Ttype link_packets_max_queuing_time()
ADD DOCUMENTATION HERE.
Definitions of a Front Drop Queue class.
itpp namespace
Definition itmex.h:37
Definition of a Packet class.
Templated Vector Class Definitions.

Generated on Tue Mar 26 2024 19:08:31 for IT++ by Doxygen 1.9.8