Q2NS dev
ns-3 module
Loading...
Searching...
No Matches
q2ns::QNetDevice Class Reference

Minimal quantum net device that bridges a QChannel and a QNetworker. More...

#include <q2ns-qnet-device.h>

Inheritance diagram for q2ns::QNetDevice:
Collaboration diagram for q2ns::QNetDevice:

Public Member Functions

 QNetDevice ()
 Default constructor.
 
void BindNetworker (QNetworker &networker)
 Bind the owning networker.
 
void AttachChannel (ns3::Ptr< QChannel > ch)
 Attach this device to a quantum channel.
 
bool Send (std::shared_ptr< Qubit > q)
 Send a qubit through the attached channel.
 
ns3::Ptr< ns3::Channel > GetChannel () const override
 Return the attached channel.
 
void SetNode (ns3::Ptr< ns3::Node > node) override
 Set the owning ns-3 node.
 
ns3::Ptr< ns3::Node > GetNode () const override
 Get the owning ns-3 node.
 
void SetIfIndex (std::uint32_t i) override
 Set the interface index assigned by the owning node.
 
std::uint32_t GetIfIndex () const override
 Get the interface index assigned by the owning node.
 
void SetAddress (ns3::Address) override
 
ns3::Address GetAddress () const override
 
bool SetMtu (std::uint16_t) override
 
std::uint16_t GetMtu () const override
 
bool IsLinkUp () const override
 
void AddLinkChangeCallback (ns3::Callback< void >) override
 
bool IsBroadcast () const override
 
ns3::Address GetBroadcast () const override
 
bool IsMulticast () const override
 
ns3::Address GetMulticast (ns3::Ipv4Address) const override
 
ns3::Address GetMulticast (ns3::Ipv6Address) const override
 
bool IsBridge () const override
 
bool IsPointToPoint () const override
 
bool NeedsArp () const override
 
void SetReceiveCallback (ReceiveCallback) override
 
void SetPromiscReceiveCallback (PromiscReceiveCallback) override
 
bool SupportsSendFrom () const override
 
bool Send (ns3::Ptr< ns3::Packet >, const ns3::Address &, std::uint16_t) override
 
bool SendFrom (ns3::Ptr< ns3::Packet >, const ns3::Address &, const ns3::Address &, std::uint16_t) override
 

Static Public Member Functions

static ns3::TypeId GetTypeId (void)
 Get the ns-3 TypeId.
 

Private Member Functions

void ReceiveFromChannel (std::shared_ptr< Qubit > q, const QMapInstance &map={})
 Receive a qubit from the attached channel and forward it upward.
 

Private Attributes

std::uint32_t ifIndex_ = 0
 Interface index.
 
ns3::Ptr< ns3::Node > node_
 Owning ns-3 node.
 
ns3::Ptr< QChannelchannel_
 Attached quantum channel.
 
QNetworkernetworker_ = nullptr
 Bound networker, not owned.
 
friend QChannel
 

Detailed Description

Minimal quantum net device that bridges a QChannel and a QNetworker.

QNetDevice is an internal plumbing component used by QNode and QNetworker. It is intentionally small: it forwards outgoing qubits to an attached QChannel and forwards incoming qubits from that channel to the bound QNetworker.

The inherited ns-3 NetDevice interface is implemented only to the extent needed for integration with ns-3 nodes and channels.

See also
QChannel
QNetworker

Definition at line 49 of file q2ns-qnet-device.h.

Constructor & Destructor Documentation

◆ QNetDevice()

q2ns::QNetDevice::QNetDevice ( )
default

Default constructor.

Member Function Documentation

◆ AddLinkChangeCallback()

void q2ns::QNetDevice::AddLinkChangeCallback ( ns3::Callback< void >  )
inlineoverride

Definition at line 143 of file q2ns-qnet-device.h.

◆ AttachChannel()

void q2ns::QNetDevice::AttachChannel ( ns3::Ptr< QChannel ch)

Attach this device to a quantum channel.

This is normally called by QChannel when wiring the link endpoints.

Parameters
chAttached channel.
See also
QChannel::Connect

Definition at line 49 of file q2ns-qnet-device.cc.

References channel_.

◆ BindNetworker()

void q2ns::QNetDevice::BindNetworker ( QNetworker networker)

Bind the owning networker.

The bound networker is notified when a qubit is delivered from the attached channel.

Parameters
networkerOwning QNetworker.
See also
ReceiveFromChannel

Definition at line 43 of file q2ns-qnet-device.cc.

References networker_.

◆ GetAddress()

ns3::Address q2ns::QNetDevice::GetAddress ( ) const
inlineoverride

Definition at line 131 of file q2ns-qnet-device.h.

◆ GetBroadcast()

ns3::Address q2ns::QNetDevice::GetBroadcast ( ) const
inlineoverride

Definition at line 147 of file q2ns-qnet-device.h.

◆ GetChannel()

ns3::Ptr< ns3::Channel > q2ns::QNetDevice::GetChannel ( ) const
override

Return the attached channel.

Returns
Attached channel as an ns-3 Channel pointer, or nullptr if none is attached.

Definition at line 72 of file q2ns-qnet-device.cc.

References channel_.

◆ GetIfIndex()

std::uint32_t q2ns::QNetDevice::GetIfIndex ( ) const
override

Get the interface index assigned by the owning node.

Returns
Interface index.

Definition at line 96 of file q2ns-qnet-device.cc.

References ifIndex_.

◆ GetMtu()

std::uint16_t q2ns::QNetDevice::GetMtu ( ) const
inlineoverride

Definition at line 137 of file q2ns-qnet-device.h.

◆ GetMulticast() [1/2]

ns3::Address q2ns::QNetDevice::GetMulticast ( ns3::Ipv4Address  ) const
inlineoverride

Definition at line 153 of file q2ns-qnet-device.h.

◆ GetMulticast() [2/2]

ns3::Address q2ns::QNetDevice::GetMulticast ( ns3::Ipv6Address  ) const
inlineoverride

Definition at line 156 of file q2ns-qnet-device.h.

◆ GetNode()

ns3::Ptr< ns3::Node > q2ns::QNetDevice::GetNode ( ) const
override

Get the owning ns-3 node.

Returns
Owning node.

Definition at line 84 of file q2ns-qnet-device.cc.

References node_.

◆ GetTypeId()

ns3::TypeId q2ns::QNetDevice::GetTypeId ( void  )
static

Get the ns-3 TypeId.

Returns
TypeId for q2ns::QNetDevice.

Definition at line 29 of file q2ns-qnet-device.cc.

◆ IsBridge()

bool q2ns::QNetDevice::IsBridge ( ) const
inlineoverride

Definition at line 159 of file q2ns-qnet-device.h.

◆ IsBroadcast()

bool q2ns::QNetDevice::IsBroadcast ( ) const
inlineoverride

Definition at line 144 of file q2ns-qnet-device.h.

◆ IsLinkUp()

bool q2ns::QNetDevice::IsLinkUp ( ) const
inlineoverride

Definition at line 140 of file q2ns-qnet-device.h.

◆ IsMulticast()

bool q2ns::QNetDevice::IsMulticast ( ) const
inlineoverride

Definition at line 150 of file q2ns-qnet-device.h.

◆ IsPointToPoint()

bool q2ns::QNetDevice::IsPointToPoint ( ) const
inlineoverride

Definition at line 162 of file q2ns-qnet-device.h.

◆ NeedsArp()

bool q2ns::QNetDevice::NeedsArp ( ) const
inlineoverride

Definition at line 165 of file q2ns-qnet-device.h.

◆ ReceiveFromChannel()

void q2ns::QNetDevice::ReceiveFromChannel ( std::shared_ptr< Qubit q,
const QMapInstance map = {} 
)
private

Receive a qubit from the attached channel and forward it upward.

The optional sampled QMapInstance represents per-transmission channel effects to be applied by the receiving networker.

Parameters
qQubit received from the channel.
mapSampled per-transmission channel map.
See also
QNetworker::ReceiveFromDevice

Definition at line 65 of file q2ns-qnet-device.cc.

References networker_, and q2ns::QNetworker::ReceiveFromDevice().

Here is the call graph for this function:

◆ Send() [1/2]

bool q2ns::QNetDevice::Send ( ns3::Ptr< ns3::Packet >  ,
const ns3::Address &  ,
std::uint16_t   
)
inlineoverride

Definition at line 173 of file q2ns-qnet-device.h.

◆ Send() [2/2]

bool q2ns::QNetDevice::Send ( std::shared_ptr< Qubit q)

Send a qubit through the attached channel.

This method forwards the transmission request to the attached channel. It does not perform routing.

Parameters
qQubit to send.
Returns
True if the attached channel accepted the transmission request, false otherwise.
See also
QChannel::SendFrom

Definition at line 55 of file q2ns-qnet-device.cc.

References channel_.

◆ SendFrom()

bool q2ns::QNetDevice::SendFrom ( ns3::Ptr< ns3::Packet >  ,
const ns3::Address &  ,
const ns3::Address &  ,
std::uint16_t   
)
inlineoverride

Definition at line 176 of file q2ns-qnet-device.h.

◆ SetAddress()

void q2ns::QNetDevice::SetAddress ( ns3::Address  )
inlineoverride

Definition at line 130 of file q2ns-qnet-device.h.

◆ SetIfIndex()

void q2ns::QNetDevice::SetIfIndex ( std::uint32_t  i)
override

Set the interface index assigned by the owning node.

Parameters
iInterface index.

Definition at line 90 of file q2ns-qnet-device.cc.

References ifIndex_.

◆ SetMtu()

bool q2ns::QNetDevice::SetMtu ( std::uint16_t  )
inlineoverride

Definition at line 134 of file q2ns-qnet-device.h.

◆ SetNode()

void q2ns::QNetDevice::SetNode ( ns3::Ptr< ns3::Node >  node)
override

Set the owning ns-3 node.

Parameters
nodeOwning node.

Definition at line 78 of file q2ns-qnet-device.cc.

References node_.

◆ SetPromiscReceiveCallback()

void q2ns::QNetDevice::SetPromiscReceiveCallback ( PromiscReceiveCallback  )
inlineoverride

Definition at line 169 of file q2ns-qnet-device.h.

◆ SetReceiveCallback()

void q2ns::QNetDevice::SetReceiveCallback ( ReceiveCallback  )
inlineoverride

Definition at line 168 of file q2ns-qnet-device.h.

◆ SupportsSendFrom()

bool q2ns::QNetDevice::SupportsSendFrom ( ) const
inlineoverride

Definition at line 170 of file q2ns-qnet-device.h.

Member Data Documentation

◆ channel_

ns3::Ptr<QChannel> q2ns::QNetDevice::channel_
private

Attached quantum channel.

Definition at line 197 of file q2ns-qnet-device.h.

Referenced by AttachChannel(), GetChannel(), and Send().

◆ ifIndex_

std::uint32_t q2ns::QNetDevice::ifIndex_ = 0
private

Interface index.

Definition at line 195 of file q2ns-qnet-device.h.

Referenced by GetIfIndex(), and SetIfIndex().

◆ networker_

QNetworker* q2ns::QNetDevice::networker_ = nullptr
private

Bound networker, not owned.

Definition at line 198 of file q2ns-qnet-device.h.

Referenced by BindNetworker(), and ReceiveFromChannel().

◆ node_

ns3::Ptr<ns3::Node> q2ns::QNetDevice::node_
private

Owning ns-3 node.

Definition at line 196 of file q2ns-qnet-device.h.

Referenced by GetNode(), and SetNode().

◆ QChannel

friend q2ns::QNetDevice::QChannel
private

Definition at line 200 of file q2ns-qnet-device.h.


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