21 #include <boost/lexical_cast.hpp> 23 #include <senf/PPI.hh> 53 template <
class Interface>
70 : iface (config.
iface),
72 startTime(senf::scheduler::now()),
75 nextTime(startTime + period),
79 iface.interface().maxBurst(config.
maxBurst);
80 iface.interface().qlen(config.
qlen);
81 iface.interface().sndBuf(config.
txBuf);
82 iface.interface().
enable();
91 if (duration_ and (senf::scheduler::now() - startTime) >= duration_){
95 v_stats(nextTime - startTime, period);
106 template <
class Interface>
107 class AppRx :
public App<Interface>
113 : App<Interface> (config),
114 receiver(config.
peer, App<Interface>::iface.interface().id())
116 ppi::connect(App<Interface>::iface, receiver);
118 WLANInterface *wif (dynamic_cast<WLANInterface*>(&App<Interface>::iface.interface()));
123 std::cerr <<
"Receiver ready on " << config.
iface <<
", mac " << App<Interface>::iface.interface().id() <<
", peer " << config.
peer << std::endl;
128 std::cout <<
" queue-drops " << App<Interface>::iface.interface().rxQueueDropped() <<
"; ";
129 receiver.report(std::cout, period);
131 std::cout << std::endl;
135 template <
class Interface>
136 class AppTx :
public App<Interface>
142 : App<Interface> (config),
143 sender(App<Interface>::iface.interface().id(), config.
peer, config.
label)
145 ppi::connect(sender, App<Interface>::iface);
147 WLANInterface *wif (dynamic_cast<WLANInterface*>(&App<Interface>::iface.interface()));
152 sender.bitrate(config.
bitrate);
154 std::cerr <<
"Transmitter ready on " << config.
iface <<
", mac " << App<Interface>::iface.interface().id()
155 <<
", peer " << config.
peer <<
", label " << config.
label <<
", bitrate " << config.
bitrate <<
"kbps" << std::endl;
160 std::cout <<
" seqNo " << sender.seqNo;
161 WLANInterface *wif (dynamic_cast<WLANInterface*>(&App<Interface>::iface.interface()));
163 std::cout <<
", mmStats ";
164 wif->dumpMmapStats(std::cout);
166 EthernetInterface *eif (dynamic_cast<EthernetInterface*>(&App<Interface>::iface.interface()));
168 std::cout <<
", mmStats ";
169 eif->dumpMmapStats(std::cout);
171 std::cout << std::endl;
175 template <
class Application>
178 Application app (config);
183 int main(
int argc,
const char ** argv)
189 if (!config.
parse( argc, argv)) {
198 if (config.
iface.find(
"phy") == 0){
200 run< AppRx<WLANInterface> >(config);
202 run< AppTx<WLANInterface> >(config);
206 run< AppRx<EthernetInterface>>(config);
208 run< AppTx<EthernetInterface> >(config);
senf::ClockService::clock_type duration
config::time_type clock_type
static Server & start(senf::INet4SocketAddress const &address)
main non-inline non-template implementation
static SENF_CLOCKSERVICE_CONSTEXPR int64_type in_milliseconds(clock_type const &v)
static void logToStderr()
WirelessExtController public header.
int main(int argc, const char **argv)
virtual void terminate() const
boost::function< R(Args)> membind(R(T::*fn)(Args), T *ob)
main non-inline non-template implementation
static INet4Address const None
void timeout(ClockService::clock_type const &timeout, bool initiallyEnabled=true)
int run(int argc, char const *argv[])
senf::ClockService::clock_type reportingInterval
#define SENF_PPI_MODULE(name)
bool parse(int argc, char const *argv[])
static SENF_CLOCKSERVICE_CONSTEXPR int64_type in_seconds(clock_type const &v)
HardwareEthernetInterface public header.
HardwareWLANInterface public header.
main non-inline non-template implementation