Loading...
Searching...
No Matches
satellite-simple-net-device.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013 Magister Solutions Ltd
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Sami Rantanen <sami.rantanen@magister.fi>
19 */
20
21#ifndef SATELLITE_SIMPLE_NET_DEVICE_H
22#define SATELLITE_SIMPLE_NET_DEVICE_H
23
25
26#include "ns3/error-model.h"
27#include "ns3/net-device.h"
28#include "ns3/packet.h"
29#include "ns3/traced-callback.h"
30
31#include <stdint.h>
32
33namespace ns3
34{
35
50class SatSimpleNetDevice : public NetDevice
51{
52 public:
57 static TypeId GetTypeId(void);
58
63
68
79 void Receive(Ptr<Packet> packet, uint16_t protocol, Mac48Address to, Mac48Address from);
80
89 void SetChannel(Ptr<SatSimpleChannel> channel);
90
100 void SetReceiveErrorModel(Ptr<ErrorModel> em);
101
102 // inherited from NetDevice base class.
103 virtual void SetIfIndex(const uint32_t index);
104 virtual uint32_t GetIfIndex(void) const;
105 virtual Ptr<Channel> GetChannel(void) const;
106 virtual void SetAddress(Address address);
107 virtual Address GetAddress(void) const;
108 virtual bool SetMtu(const uint16_t mtu);
109 virtual uint16_t GetMtu(void) const;
110 virtual bool IsLinkUp(void) const;
111 virtual void AddLinkChangeCallback(Callback<void> callback);
112 virtual bool IsBroadcast(void) const;
113 virtual Address GetBroadcast(void) const;
114 virtual bool IsMulticast(void) const;
115 virtual Address GetMulticast(Ipv4Address multicastGroup) const;
116 virtual bool IsPointToPoint(void) const;
117 virtual bool IsBridge(void) const;
118 virtual bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
119 virtual bool SendFrom(Ptr<Packet> packet,
120 const Address& source,
121 const Address& dest,
122 uint16_t protocolNumber);
123 virtual Ptr<Node> GetNode(void) const;
124 virtual void SetNode(Ptr<Node> node);
125 virtual bool NeedsArp(void) const;
126 virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb);
127
128 virtual Address GetMulticast(Ipv6Address addr) const;
129
130 virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb);
131 virtual bool SupportsSendFrom(void) const;
132
133 protected:
137 virtual void DoDispose(void);
138
139 private:
140 Ptr<SatSimpleChannel> m_channel;
141 NetDevice::ReceiveCallback m_rxCallback;
142 NetDevice::PromiscReceiveCallback m_promiscCallback;
143 Ptr<Node> m_node;
144 uint16_t m_mtu;
145 uint32_t m_ifIndex;
146 Mac48Address m_address;
147 Ptr<ErrorModel> m_receiveErrorModel;
156 TracedCallback<Ptr<const Packet>> m_phyRxDropTrace;
157};
158
159} // namespace ns3
160
161#endif /* SATELLITE_SIMPLE_NET_DEVICE_H */
virtual Address GetBroadcast(void) const
virtual uint16_t GetMtu(void) const
void Receive(Ptr< Packet > packet, uint16_t protocol, Mac48Address to, Mac48Address from)
Receive a packet from a connected SatSimpleChannel.
virtual void SetNode(Ptr< Node > node)
void SetChannel(Ptr< SatSimpleChannel > channel)
Attach a channel to this net device.
virtual uint32_t GetIfIndex(void) const
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
static TypeId GetTypeId(void)
Get the type ID.
virtual bool SupportsSendFrom(void) const
virtual void SetIfIndex(const uint32_t index)
virtual Ptr< Node > GetNode(void) const
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
virtual bool IsBroadcast(void) const
SatSimpleNetDevice()
Default constructor.
NetDevice::ReceiveCallback m_rxCallback
virtual Address GetAddress(void) const
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
NetDevice::PromiscReceiveCallback m_promiscCallback
virtual void AddLinkChangeCallback(Callback< void > callback)
~SatSimpleNetDevice()
Destructor for SatSimpleNetDevice.
virtual void DoDispose(void)
Dispose of this class instance.
virtual bool IsPointToPoint(void) const
virtual void SetAddress(Address address)
TracedCallback< Ptr< const Packet > > m_phyRxDropTrace
The trace source fired when the phy layer drops a packet it has received due to the error model being...
virtual bool SetMtu(const uint16_t mtu)
virtual Ptr< Channel > GetChannel(void) const
virtual Address GetMulticast(Ipv4Address multicastGroup) const
void SetReceiveErrorModel(Ptr< ErrorModel > em)
Attach a receive ErrorModel to the SimpleNetDevice.
virtual bool IsMulticast(void) const
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.