IT++ Logo Newcom Logo

packet_channel.h

Go to the documentation of this file.
00001 
00033 #ifndef PACKET_CHANNEL_H
00034 #define PACKET_CHANNEL_H
00035 
00036 #include <itpp/protocol/packet.h>
00037 #include <itpp/base/vec.h>
00038 
00039 
00040 namespace itpp {
00041 
00045   class Packet_Channel {
00046   public:  
00047     Packet_Channel();
00048     Packet_Channel(const double Pr, const Ttype Delay, const double Block_rate, const int Max_slots = 0);
00049 
00050     ~Packet_Channel();
00051 
00052     // -- Slots -- //
00053     Slot<Packet_Channel, bool> start;
00054     Slot<Packet_Channel, Link_Packet*> input;
00055     Slot<Packet_Channel, int> nof_inputs;
00056 
00057     // -- Signals -- //
00058     Signal<Link_Packet*> output;
00059     Signal<int> input_request;
00060     Signal<void*> get_nof_inputs;
00061 
00062     void set_parameters(const double Pr, const Ttype Delay, const double Block_rate, const int Max_slots);
00063 
00064     void set_errors(const ivec &Lost);
00065 
00066   private:    
00067     void block_rate_loop();
00068     void handle_input(Link_Packet* M);
00069     void handle_start(const bool start);
00070     void handle_nof_inputs(const int N);
00071 
00072     bool keep_running;
00073     bool parameters_ok;
00074     bool explicit_errors;
00075     bool lose;
00076     double pr;
00077     Ttype delay;
00078     double block_time;
00079     int max_slots;
00080     ivec lost;
00081     int k,K,L;
00082   };
00083 
00084 
00088   class ACK_Channel {
00089   public:  
00090     ACK_Channel();
00091 
00092     ACK_Channel(const double Pr, const Ttype Delay);
00093 
00094     ~ACK_Channel();
00095 
00096     // -- Slots -- //
00097     Slot<ACK_Channel, ACK*> input;
00098 
00099     // -- Signals -- //
00100     Signal<ACK*> output;
00101 
00102     void set_parameters(const double Pr, const Ttype Delay);
00103     void set_errors(const ivec& Lost);
00104 
00105   private:    
00106     void handle_input(ACK* M);
00107 
00108     bool parameters_ok;
00109     bool explicit_errors;
00110     bool lose;
00111     double pr;
00112     Ttype delay;
00113     ivec lost;
00114     int k, K, L;
00115   };
00116 
00117 } // namespace itpp
00118 
00119 #endif // #ifndef PACKET_CHANNEL_H
00120 
SourceForge Logo

Generated on Fri Jun 8 01:07:14 2007 for IT++ by Doxygen 1.5.2