Wireless spectrum management. More...

#include <senf/Ext/NetEmu/EmulatedWirelessInterface.hh>

Inheritance diagram for senf::emu::EmulatedFrequencyRegistry:

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 >::typeEntriesRange
 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 ()
 

Detailed Description

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

consoleGroup239.202.104.1:4701

multicast group and port for control messages

addressRange239.202.108.0/22, 11264multicast 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.

Warning
You must start the registry before any traffic will flow. This start command must be sent to all nodes when all nodes are up and running. The command can be sent by multicasting 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.

Member Typedef Documentation

◆ CollisionCallback

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.

◆ EntriesRange

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.

◆ UserCallback

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.

◆ UsersRange

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.

Member Enumeration Documentation

◆ ChangeType

Enumerator
JOIN 
LEAVE 
STOP 

Definition at line 234 of file EmulatedWirelessInterface.hh.

Member Function Documentation

◆ addressRange() [1/2]

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.

Warning
It must be ensured, that all the multicast addresses and ports in the range are free to use.

◆ addressRange() [2/2]

void senf::emu::EmulatedFrequencyRegistry::addressRange ( INet4Network const &  range,
unsigned  portbase 
)

Change address/port range of channel multicast addresses.

See also
addressRange()

◆ allocate()

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.

◆ collisionCallback()

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.

◆ consoleGroup() [1/2]

UDPClientHandle::Address senf::emu::EmulatedFrequencyRegistry::consoleGroup ( ) const

Get control channel multicast group/port.

◆ consoleGroup() [2/2]

void senf::emu::EmulatedFrequencyRegistry::consoleGroup ( UDPClientHandle::Address const &  group)

Change control channel multicast group/port.

◆ entries()

EntriesRange senf::emu::EmulatedFrequencyRegistry::entries ( ) const

Get all channel entries.

◆ nextAddress()

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.

◆ release()

void senf::emu::EmulatedFrequencyRegistry::release ( unsigned  interfaceId)

Release channel registration.

See also
allocate()

Definition at line 107 of file EmulatedWirelessInterface.cc.

◆ schedulerStart()

void senf::emu::EmulatedFrequencyRegistry::schedulerStart ( )

Definition at line 170 of file EmulatedWirelessInterface.cc.

◆ start()

void senf::emu::EmulatedFrequencyRegistry::start ( )

Start multicast address/port allocation.

Definition at line 358 of file EmulatedWirelessInterface.cc.

◆ stop()

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.

◆ users()

UsersRange senf::emu::EmulatedFrequencyRegistry::users ( EntriesRange::iterator  i) const

Get interface id's of local users of a given channel.

Member Data Documentation

◆ channelPopulationChanged

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.


The documentation for this class was generated from the following files: