-
Notifications
You must be signed in to change notification settings - Fork 0
/
NanoNetDevice.h
121 lines (88 loc) · 3.73 KB
/
NanoNetDevice.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
* NanoNetDevice.h
* Copyright (c) 2024 Technische Universität Berlin
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Created on: 2023. 12. 6.
* Author: Laurenz Ebner
*/
#ifndef CLASS_NanoNetDevice_
#define CLASS_NanoNetDevice_
#include "BVSChannel.h"
#include "GatewayNetDevice.h"
namespace ns3 {
class BVSChannel;
/**
* \brief NanoNetDevice models the communication device at each nanobot
*
* It is instantiated when the nanobot is created, creates random data each time it passes the tissue_ID and
* sends the data to the gateway via the channel function send()
*/
class NanoNetDevice : public NetDevice
{
public:
//static TypeId GetTypeId (void);
//constructor
NanoNetDevice ();
//NanoNetDevice(Ptr<BVSChannel> Channel);
//deconstructor
~NanoNetDevice ();
//specify the channel pointer where to transmit in
void SetChannel(Ptr<BVSChannel> channel);
//get the channel pointer
Ptr<BVSChannel> GetBVSChannel();
//create the measurement data
void createMacPhyData(int tissue_ID, int nanobot_ID);
//get the transmission package
MAC_PHY_DATA *getMacPhyData();
//intall to the node inside of the nanobot class
void installToNode(Ptr<Node> node);
// inherited from NetDevice base class, are set to dummy values
void SetIfIndex(const uint32_t index) override{};
uint32_t GetIfIndex() const override{return 0;};
Ptr<Channel> GetChannel() const override;
void SetAddress(Address address) override;
Address GetAddress() const override;
bool SetMtu(const uint16_t mtu) override{return false;};
uint16_t GetMtu() const override{return 0;};
bool IsLinkUp() const override{return false;};
void AddLinkChangeCallback(Callback<void> callback) override{};
bool IsBroadcast() const override{return false;};
Address GetBroadcast() const override{return Mac48Address("ff:ff:ff:ff:ff:ff");};
bool IsMulticast() const override{return false;};
Address GetMulticast(Ipv4Address multicastGroup) const override
{return Mac48Address("ff:ff:ff:ff:ff:ff");};
bool IsPointToPoint() const override{return false;};
bool IsBridge() const override{return false;};
bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) override;
bool SendFrom(Ptr<Packet> packet,
const Address& source,
const Address& dest,
uint16_t protocolNumber) override;
Ptr<Node> GetNode() const override;
void SetNode(Ptr<Node> node) override;
bool NeedsArp() const override{return false;};
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override{};
Address GetMulticast(Ipv6Address addr) const override{return Mac48Address::GetMulticast(addr);};
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override{};
bool SupportsSendFrom() const override{return false;};
private:
Mac48Address m_address;
Ptr<BVSChannel> m_channel;
Ptr<Packet> packet;
Ptr<Node> m_node;
MAC_PHY_DATA *m_mac_phy_data;
};
}; //end namespace
#endif