Wireless spectrum management. More...
#include <senf/Ext/NetEmu/EmulatedWirelessInterface.hh>

Classes | |
| struct | Entry |
| Channel allocation entry. More... | |
Public Types | |
| enum | ChangeType { JOIN, LEAVE, STOP } |
| typedef boost::function< void(UDPClientHandle::Address const &address)> | UserCallback |
| Callback type called to set channel address. More... | |
| typedef boost::function< void(unsigned frequency, unsigned bandwidth)> | CollisionCallback |
| Callback type called for channel collisions. More... | |
| typedef boost::iterator_range< Entries::index_iterator< ByFrequency >::type > | EntriesRange |
| Iterator range of channel entries. More... | |
| typedef boost::iterator_range< InterfaceIdIterator > | UsersRange |
| Iterator range of interface id's using a channel. More... | |
Public Member Functions | |
| UDPClientHandle::Address | consoleGroup () const |
| Get control channel multicast group/port. More... | |
| void | consoleGroup (UDPClientHandle::Address const &group) |
| Change control channel multicast group/port. More... | |
| std::pair< INet4Network, unsigned > | addressRange () const |
| Get address/port range of channel multicast addresses. More... | |
| void | addressRange (INet4Network const &range, unsigned portbase) |
| Change address/port range of channel multicast addresses. More... | |
| void | nextAddress (unsigned index) |
| Set next address index to use (if free) More... | |
| void | allocate (unsigned interfaceId, unsigned frequency, unsigned bandwidth, UserCallback cb) |
| Register for a wireless channel. More... | |
| void | release (unsigned interfaceId) |
| Release channel registration. More... | |
| void | collisionCallback (CollisionCallback cb) |
| Change collision callback. More... | |
| void | schedulerStart () |
| void | start () |
| Start multicast address/port allocation. More... | |
| void | stop () |
| Stop multicast address/port allocation. More... | |
| EntriesRange | entries () const |
| Get all channel entries. More... | |
| UsersRange | users (EntriesRange::iterator i) const |
| Get interface id's of local users of a given channel. More... | |
Public Attributes | |
| boost::signals2::signal< void(Entry const &, unsigned nodeId, ChangeType type)> | channelPopulationChanged |
| Channel population changed signal. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from senf::singleton< EmulatedFrequencyRegistry > | |
| singleton () | |
| ~singleton () | |
Static Protected Member Functions inherited from senf::singleton< EmulatedFrequencyRegistry > | |
| static Self & | instance () |
| static bool | alive () |
Wireless spectrum management.
EmulatedFrequencyRegistry manages all wireless channels. It associates each channel with a multicast group and port number on which all traffic for that channel is carried. The coordination between several nodes is managed using a special console server on another multicast port.
The EmulatedFrequencyRegistry is a singleton. The registry manages all frequencies for any technology.
| Default | Description | |
| consoleGroup | 239.202.104.1:4701 | multicast group and port for control messages |
|---|---|---|
| addressRange | 239.202.108.0/22, 11264 | multicast address and port range to allocate to channels |
You will not normally use the registry directly. Instead, each wireless interface implementation calls on the registry for multicast group assignment.
start to the console group.To reinitialize after a node has died or a new node has come alive, restart the registry by sending first stop and (after a short delay) start to all nodes.
Definition at line 72 of file EmulatedWirelessInterface.hh.
| typedef boost::function<void (unsigned frequency, unsigned bandwidth)> senf::emu::EmulatedFrequencyRegistry::CollisionCallback |
Callback type called for channel collisions.
Definition at line 80 of file EmulatedWirelessInterface.hh.
| typedef boost::iterator_range<Entries::index_iterator<ByFrequency>::type> senf::emu::EmulatedFrequencyRegistry::EntriesRange |
Iterator range of channel entries.
Definition at line 170 of file EmulatedWirelessInterface.hh.
| typedef boost::function<void (UDPClientHandle::Address const & address)> senf::emu::EmulatedFrequencyRegistry::UserCallback |
Callback type called to set channel address.
Definition at line 75 of file EmulatedWirelessInterface.hh.
| typedef boost::iterator_range<InterfaceIdIterator> senf::emu::EmulatedFrequencyRegistry::UsersRange |
Iterator range of interface id's using a channel.
Definition at line 172 of file EmulatedWirelessInterface.hh.
| Enumerator | |
|---|---|
| JOIN | |
| LEAVE | |
| STOP | |
Definition at line 234 of file EmulatedWirelessInterface.hh.
| std::pair<INet4Network, unsigned> senf::emu::EmulatedFrequencyRegistry::addressRange | ( | ) | const |
Get address/port range of channel multicast addresses.
Returns a pair networkAndMask, startPort. Multicast ports are allocated from networkAndMask. Ports are allocated starting at startPort. The number of valid ports is given by the size of the multicast network.
| void senf::emu::EmulatedFrequencyRegistry::addressRange | ( | INet4Network const & | range, |
| unsigned | portbase | ||
| ) |
Change address/port range of channel multicast addresses.
| void senf::emu::EmulatedFrequencyRegistry::allocate | ( | unsigned | interfaceId, |
| unsigned | frequency, | ||
| unsigned | bandwidth, | ||
| UserCallback | cb | ||
| ) |
Register for a wireless channel.
Registers interest in the network channel at frequency/bandwidth. As soon as a multicast address/port assignment is available, cb is called with this address/port.
cb will be called, whenever the multicast address/port changes.
Definition at line 76 of file EmulatedWirelessInterface.cc.
| void senf::emu::EmulatedFrequencyRegistry::collisionCallback | ( | CollisionCallback | cb | ) |
Change collision callback.
The callback cb is called whenever a channel collision is detected. A collision is detected if two different channels overlap. A collision is never detected for two identical channels since two requests for the same channel will automatically be merged into one channel.
| UDPClientHandle::Address senf::emu::EmulatedFrequencyRegistry::consoleGroup | ( | ) | const |
Get control channel multicast group/port.
| void senf::emu::EmulatedFrequencyRegistry::consoleGroup | ( | UDPClientHandle::Address const & | group | ) |
Change control channel multicast group/port.
| EntriesRange senf::emu::EmulatedFrequencyRegistry::entries | ( | ) | const |
Get all channel entries.
| void senf::emu::EmulatedFrequencyRegistry::nextAddress | ( | unsigned | index | ) |
Set next address index to use (if free)
This sets the internal address counter to index. The next address allocated will be at index if that address is available.
| void senf::emu::EmulatedFrequencyRegistry::release | ( | unsigned | interfaceId | ) |
Release channel registration.
Definition at line 107 of file EmulatedWirelessInterface.cc.
| void senf::emu::EmulatedFrequencyRegistry::schedulerStart | ( | ) |
Definition at line 170 of file EmulatedWirelessInterface.cc.
| void senf::emu::EmulatedFrequencyRegistry::start | ( | ) |
Start multicast address/port allocation.
Definition at line 358 of file EmulatedWirelessInterface.cc.
| void senf::emu::EmulatedFrequencyRegistry::stop | ( | ) |
Stop multicast address/port allocation.
Calling stop will purge all channel entries except those registered by local interfaces.
Definition at line 387 of file EmulatedWirelessInterface.cc.
| UsersRange senf::emu::EmulatedFrequencyRegistry::users | ( | EntriesRange::iterator | i | ) | const |
Get interface id's of local users of a given channel.
| boost::signals2::signal<void ( Entry const &, unsigned nodeId, ChangeType type)> senf::emu::EmulatedFrequencyRegistry::channelPopulationChanged |
Channel population changed signal.
This signal is emitted, whenever the population of a channel changes.
Definition at line 236 of file EmulatedWirelessInterface.hh.