Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
itpp
protocol
packet_channel.h
Go to the documentation of this file.
1
29
#ifndef PACKET_CHANNEL_H
30
#define PACKET_CHANNEL_H
31
32
#include <
itpp/protocol/packet.h
>
33
#include <
itpp/base/vec.h
>
34
35
36
namespace
itpp
37
{
38
40
41
43
class
Packet_Channel
44
{
45
public
:
47
Packet_Channel
();
49
Packet_Channel
(
const
double
Pr,
const
Ttype
Delay,
const
double
Block_rate,
const
int
Max_slots = 0);
50
52
~Packet_Channel
();
53
54
// -- Slots -- //
56
Slot<Packet_Channel, bool>
start
;
58
Slot<Packet_Channel, Link_Packet*>
input
;
60
Slot<Packet_Channel, int>
nof_inputs
;
61
62
// -- Signals -- //
64
Signal<Link_Packet*>
output
;
66
Signal<int>
input_request
;
68
Signal<void*>
get_nof_inputs
;
69
71
void
set_parameters
(
const
double
Pr,
const
Ttype
Delay,
const
double
Block_rate,
const
int
Max_slots);
72
74
void
set_errors
(
const
ivec &Lost);
75
76
private
:
77
void
block_rate_loop();
78
void
handle_input(
Link_Packet
* M);
79
void
handle_start(
const
bool
start
);
80
void
handle_nof_inputs(
const
int
N);
81
82
bool
keep_running;
83
bool
parameters_ok;
84
bool
explicit_errors;
85
bool
lose;
86
double
pr;
87
Ttype
delay;
88
double
block_time;
89
int
max_slots;
90
ivec lost;
91
int
k, K, L;
92
};
93
94
96
class
ACK_Channel
97
{
98
public
:
100
ACK_Channel
();
101
103
ACK_Channel
(
const
double
Pr,
const
Ttype
Delay);
104
106
~ACK_Channel
();
107
108
// -- Slots -- //
110
Slot<ACK_Channel, ACK*>
input
;
111
112
// -- Signals -- //
114
Signal<ACK*>
output
;
115
117
void
set_parameters
(
const
double
Pr,
const
Ttype
Delay);
119
void
set_errors
(
const
ivec& Lost);
120
121
private
:
122
void
handle_input(
ACK
* M);
123
124
bool
parameters_ok;
125
bool
explicit_errors;
126
bool
lose;
127
double
pr;
128
Ttype
delay;
129
ivec lost;
130
int
k, K, L;
131
};
132
134
135
}
// namespace itpp
136
137
#endif // #ifndef PACKET_CHANNEL_H
138
Generated on Fri Mar 21 2014 17:14:13 for IT++ by
Doxygen
1.8.1.2