IT++ Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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/protocol/packet.h>
34 #include <itpp/base/vec.h>
35 #include <itpp/base/array.h>
36 
37 
38 namespace itpp
39 {
40 
42 
43 
48 {
49 public:
52 
54  Selective_Repeat_ARQ_Sender(const int Seq_no_size, const int Buffer_size_factor, const int Link_packet_size, const Ttype Time_out);
55 
58 
60  void set_parameters(const int Seq_no_size, // # bits in sequence no.
61  const int Buffer_size_factor, // Link-packet buffer size = 2^(Seq_no_size)*Buffer_size_factor.
62  const int Link_packet_size, // Size of the link packets in bytes.
63  const Ttype Time_out); // Idle time before retransmission.
64 
65  // -- Slots -- //
70 
71  // -- Signals -- //
75 
77  int buffer_size();
87  void get_link_packets(const int K, Array<Packet*> &pa);
88 
89 private:
90  void handle_ack_input(Array<Packet*> packet_array); // Take care of incomming ack/nacks.
91  void handle_packet_input(Packet *P); // Take care of incomming packets.
92  void handle_packet_output_request(int K); // Take care of incomming packet requests.
93  void handle_query_nof_ready_packets(void*); // Take care of incomming query for number of packets ready to transmit.
94  void retransmit(int Sequence_number); // Take care of incomming query for number of packets ready to transmit.
95  void remove(const int Sequence_number);
96  void push_packet_on_tx_buffer(Packet *packet);
97  int buffered_non_outstanding();
98  int free_sequence_numbers();
99  int sequence_number_2_buffer_index(const int Sequence_number);
100  void schedule_output(const int Buffer_index, const int Sequence_number, const bool Retransmission);
101  void cancel_output(const int Sequence_number);
102  void fill_output();
103  int feasable_blocks();
104  bool parameters_ok;
105  Front_Drop_Queue ip_pkt_queue;
106  Array<Link_Packet*> input_buffer;
107  int input_buffer_size;
108  int input_next;
109  int input_free_space;
110  int seq_no_size;
111  int seq_no;
112  int seq_no_max;
113  int tx_next;
114  int tx_last;
115  int outstanding;
116  int id;
117  Ttype time_out;
119  ivec output_indexes;
120  ivec retransmission_indexes;
121  int rd_pos;
122  int rt_pos;
123  int scheduled_total;
124  int scheduled_retransmissions;
125  int no_retransmit;
126  int link_packet_size;
127 };
128 
129 
134 {
135 public:
138 
140  Selective_Repeat_ARQ_Receiver(const int Seq_no_size);
141 
144 
145  // -- Slots -- //
147 
148  // -- Signals -- //
151 
153  void set_parameters(const int Seq_no_size); // # bits in sequence no.
154 
155 private:
156  bool greater_modulo_L(const int a, const int b);
157  void handle_packet_input(Array<Packet*>); // Take care of incomming packets.
158  int seq_no_size;
159  int seq_no_max;
160  Array<Link_Packet*> rx_buffer;
161  int Rnext;
162  int id;
163  bool parameters_ok;
164 };
165 
167 
168 } // namespace itpp
169 
170 #endif // #ifndef SELECTIVE_REPEAT_H
171 
SourceForge Logo

Generated on Fri Mar 21 2014 17:14:13 for IT++ by Doxygen 1.8.1.2