IT++ Logo

packet_channel.h

Go to the documentation of this file.
00001 
00030 #ifndef PACKET_CHANNEL_H
00031 #define PACKET_CHANNEL_H
00032 
00033 #include <itpp/protocol/packet.h>
00034 #include <itpp/base/vec.h>
00035 
00036 
00037 namespace itpp {
00038 
00040 
00041 
00043   class Packet_Channel {
00044   public:
00046     Packet_Channel();
00048     Packet_Channel(const double Pr, const Ttype Delay, const double Block_rate, const int Max_slots = 0);
00049 
00051     ~Packet_Channel();
00052 
00053     // -- Slots -- //
00055     Slot<Packet_Channel, bool> start;
00057     Slot<Packet_Channel, Link_Packet*> input;
00059     Slot<Packet_Channel, int> nof_inputs;
00060 
00061     // -- Signals -- //
00063     Signal<Link_Packet*> output;
00065     Signal<int> input_request;
00067     Signal<void*> get_nof_inputs;
00068 
00070     void set_parameters(const double Pr, const Ttype Delay, const double Block_rate, const int Max_slots);
00071 
00073     void set_errors(const ivec &Lost);
00074 
00075   private:
00076     void block_rate_loop();
00077     void handle_input(Link_Packet* M);
00078     void handle_start(const bool start);
00079     void handle_nof_inputs(const int N);
00080 
00081     bool keep_running;
00082     bool parameters_ok;
00083     bool explicit_errors;
00084     bool lose;
00085     double pr;
00086     Ttype delay;
00087     double block_time;
00088     int max_slots;
00089     ivec lost;
00090     int k,K,L;
00091   };
00092 
00093 
00095   class ACK_Channel {
00096   public:
00098     ACK_Channel();
00099 
00101     ACK_Channel(const double Pr, const Ttype Delay);
00102 
00104     ~ACK_Channel();
00105 
00106     // -- Slots -- //
00108     Slot<ACK_Channel, ACK*> input;
00109 
00110     // -- Signals -- //
00112     Signal<ACK*> output;
00113 
00115     void set_parameters(const double Pr, const Ttype Delay);
00117     void set_errors(const ivec& Lost);
00118 
00119   private:
00120     void handle_input(ACK* M);
00121 
00122     bool parameters_ok;
00123     bool explicit_errors;
00124     bool lose;
00125     double pr;
00126     Ttype delay;
00127     ivec lost;
00128     int k, K, L;
00129   };
00130 
00132 
00133 } // namespace itpp
00134 
00135 #endif // #ifndef PACKET_CHANNEL_H
00136 
SourceForge Logo

Generated on Sat Apr 19 10:43:55 2008 for IT++ by Doxygen 1.5.5