template<class Medium, class Direction, class Transport = void, class Base = void>
class senf::emu::InterfaceAPIBase< Medium, Direction, Transport, Base >
Interface implementation base-class.
InterfaceAPIBase is the helper base-class for implementing interface types. Depending on the template arguments, the class will select the correct set of base classes.
- Template Parameters
-
The real interface implementation will be some PPI network which produces received packets on an output connector or jack and will receive packets on an input connector to be sent via the network device.
For emulated interfaces, the 'hardware device' is provided by the base classes via two jacks, receiverJack for incoming packets and transmitterJack for outgoing packets. You will need to connect these jacks to your internal network.
struct MyInterfaceNet
{
ppi::connector::ActiveOutputJack<EthernetPacket> myOutput;
ppi::connector::PassiveInputJack<EthernetPacket> myInput;
ppi::connector::PassiveInputJack<> myReceiveInput;
ppi::connector::ActiveOutputJack<> myTransmitOutput;
};
class MyInterface
: private MyInterfaceNet,
senf::emu::interface::Wireless>
{
public:
MyInterface()
: Base (myOutput, myInput)
{
senf::ppi::connect(receiverJack, myReceiveInput);
senf::ppi::connect(myTransmitOutput, transmitterJack);
registerFrequency(minFreq, maxFreq, minBw, maxBw);
registerFrequency(
freq, bw);
registerParameter(label, efficiency, minrssi);
registerTxPower(minPower, maxPower);
registerTxPower(power);
}
private:
virtual void v_enable();
virtual void v_disable();
virtual bool v_enabled() const;
virtual unsigned v_mtu() const;
virtual void v_mtu(unsigned v);
virtual bool v_promisc() const;
virtual void v_promisc(bool v);
virtual bool v_annotationMode() const;
virtual void v_annotationMode(bool a);
virtual unsigned v_frequency() const;
virtual unsigned v_bandwidth() const;
virtual void v_frequency(
unsigned freq,
unsigned bw);
virtual unsigned v_modulationId() const;
virtual void v_modulationId(unsigned id);
virtual int v_txPower() const;
virtual void v_txPower(int power);
};
Definition at line 161 of file InterfaceAPIBase.hh.