Internet-node module dox

Raj Bhattacharjea 2007-05-16 16:39:32 -04:00
parent 37aa2a4bd2
commit b852e0492e
11 changed files with 219 additions and 30 deletions

View File

@ -54,6 +54,7 @@ public:
* \param n node associated to this application
* \param rip remote ip address
* \param rport remove port number
* \param iid
* \param ontime on time random variable
* \param offtime off time random variable
*/
@ -68,6 +69,7 @@ public:
* \param n node associated to this application
* \param rip remote ip address
* \param rport remove port number
* \param iid
* \param ontime on time random variable
* \param offtime off time random variable
* \param rate data rate when on

View File

@ -548,7 +548,7 @@ Callback<R,T1,T2,T3,T4,T5> MakeNullCallback (void) {
}
/**
/*
* The following is experimental code. It works but we have
* not yet determined whether or not it is really useful and whether
* or not we really want to use it.

View File

@ -35,16 +35,30 @@ namespace ns3 {
class NetDevice;
class Ipv4Interface;
/**
* \brief An ARP cache
*
* A cached lookup table for translating layer 3 addresses to layer 2.
* This implementation does lookups from IPv4 to a MAC address
*/
class ArpCache {
public:
class Entry;
/**
* \param device The hardware NetDevice associated with this ARP chache
* \param interface the Ipv4Interface associated with this ARP chache
*/
ArpCache (Ptr<NetDevice> device, Ipv4Interface *interface);
~ArpCache ();
/**
* \return The NetDevice that this ARP cache is associated with
*/
Ptr<NetDevice> GetDevice (void) const;
/**
* \return the Ipv4Interface that this ARP cache is associated with
*/
Ipv4Interface *GetInterface (void) const;
void SetAliveTimeout (Time aliveTimeout);
void SetDeadTimeout (Time deadTimeout);
void SetWaitReplyTimeout (Time waitReplyTimeout);
@ -52,26 +66,71 @@ public:
Time GetDeadTimeout (void) const;
Time GetWaitReplyTimeout (void) const;
/**
* \brief Do lookup in the ARP chache against an IP address
* \param destination The destination IPv4 address to lookup the MAC address
* of
* \return An ArpCache::Entry with info about layer 2
*/
ArpCache::Entry *Lookup (Ipv4Address destination);
/**
* \brief Add an Ipv4Address to this ARP cache
*/
ArpCache::Entry *Add (Ipv4Address to);
/**
* \brief Clear the ArpCache of all entries
*/
void Flush (void);
/**
* \brief A record that that holds information about an ArpCache entry
*/
class Entry {
public:
/**
* \brief Constructor
* \param arp The ArpCache this entry belongs to
*/
Entry (ArpCache *arp);
void MarkDead (void);
Packet MarkAlive (MacAddress macAddress);
void MarkWaitReply (Packet waiting);
Packet UpdateWaitReply (Packet waiting);
/**
* \brief Changes the state of this entry to dead
*/
void MarkDead (void);
/**
* \param macAddress
* \return
*/
Packet MarkAlive (MacAddress macAddress);
/**
* \param waiting
*/
void MarkWaitReply (Packet waiting);
/**
* \param waiting
* \return
*/
Packet UpdateWaitReply (Packet waiting);
/**
* \return True if the state of this entry is dead; false otherwise.
*/
bool IsDead (void);
/**
* \return True if the state of this entry is alive; false otherwise.
*/
bool IsAlive (void);
/**
* \return True if the state of this entry is wait_reply; false otherwise.
*/
bool IsWaitReply (void);
/**
* \return The MacAddress of this entry
*/
MacAddress GetMacAddress (void);
/**
* \return True if this entry has timedout; false otherwise.
*/
bool IsExpired (void);
private:
enum ArpCacheEntryState_e {

View File

@ -27,7 +27,9 @@
#include "ns3/ipv4-address.h"
namespace ns3 {
/**
* \brief The packet header for an ARP packet
*/
class ArpHeader : public Header {
public:
virtual ~ArpHeader ();
@ -48,9 +50,22 @@ class ArpHeader : public Header {
Ipv4Address GetDestinationIpv4Address (void);
private:
/**
* \param os
*/
virtual void PrintTo (std::ostream &os) const;
/**
* \return
*/
virtual uint32_t GetSerializedSize (void) const;
/**
* \param start
*/
virtual void SerializeTo (Buffer::Iterator start) const;
/**
* \param start
* \return
*/
virtual uint32_t DeserializeFrom (Buffer::Iterator start);
enum ArpType_e {

View File

@ -35,18 +35,33 @@ class INode;
class Packet;
class TraceResolver;
class TraceContext;
/**
* \brief An implementation of the ARP protocol
*/
class Arp : public L3Protocol
{
public:
static const uint16_t PROT_NUMBER;
/**
* \brief Constructor
* \param node The node which this ARP object is associated with
*/
Arp (Ptr<INode> node);
~Arp ();
virtual TraceResolver *CreateTraceResolver (TraceContext const &context);
/**
* \brief Recieve a packet
*/
virtual void Receive(Packet& p, Ptr<NetDevice> device);
/**
* \brief Perform an ARP lookup
* \param p
* \param destination
* \param device
* \param hardwareDestination
* \return
*/
bool Lookup (Packet &p, Ipv4Address destination,
Ptr<NetDevice> device,
MacAddress *hardwareDestination);

View File

@ -26,26 +26,71 @@
#include "ns3/ipv4-address.h"
namespace ns3 {
/**
* \brief Packet header for IPv4
*/
class Ipv4Header : public Header {
public:
/**
* \brief Construct a null IPv4 header
*/
Ipv4Header ();
virtual ~Ipv4Header ();
/**
* \brief Enable checksum calculation for IP (XXX currently has no effect)
*/
static void EnableChecksums (void);
/**
* \param size
*/
void SetPayloadSize (uint16_t size);
/**
* \param identification
*/
void SetIdentification (uint16_t identification);
void SetTos (uint8_t);
/**
* \param tos
*/
void SetTos (uint8_t tos);
/**
*
*/
void SetMoreFragments (void);
/**
*
*/
void SetLastFragment (void);
/**
*
*/
void SetDontFragment (void);
/**
*
*/
void SetMayFragment (void);
/**
* \param offset
*/
void SetFragmentOffset (uint16_t offset);
void SetTtl (uint8_t);
void SetProtocol (uint8_t);
/**
* \param ttl
*/
void SetTtl (uint8_t ttl);
/**
* \param num
*/
void SetProtocol (uint8_t num);
/**
* \param source
*/
void SetSource (Ipv4Address source);
/**
* \param destination
*/
void SetDestination (Ipv4Address destination);
/**
* \param
*/
uint16_t GetPayloadSize (void) const;

View File

@ -28,10 +28,16 @@
namespace ns3 {
class INode;
/**
* \brief An IPv4 loopback interface
*/
class Ipv4LoopbackInterface : public Ipv4Interface
{
public:
/**
* \brief Constructor
* \param node Pointer to a node associated with this IPv4 interface
*/
Ipv4LoopbackInterface (Ptr<INode> node);
virtual ~Ipv4LoopbackInterface ();

View File

@ -157,7 +157,7 @@ public:
void RemoveRoute (uint32_t i);
/**
* \param interface interface to add to the list of ipv4 interfaces
* \param device interface to add to the list of ipv4 interfaces
* which can be used as output interfaces during packet forwarding.
* \returns the index of the interface added.
*

View File

@ -42,8 +42,13 @@ class L3Protocol : public Object {
public:
L3Protocol(int protocolNumber, int version);
virtual ~L3Protocol ();
/**
* \return The protocol number of this Layer 3 protocol
*/
int GetProtocolNumber (void) const;
/**
* \return The version number of this protocol
*/
int GetVersion() const;
virtual TraceResolver *CreateTraceResolver (TraceContext const &context) = 0;

View File

@ -27,19 +27,39 @@
#include "ns3/ipv4-address.h"
namespace ns3 {
/**
* \brief Packet header for UDP packets
*/
class UdpHeader : public Header {
public:
/**
* \brief Constructor
*
* Creates a null header
*/
UdpHeader ();
virtual ~UdpHeader ();
static void EnableChecksums (void);
/**
* \param port the destination port for this UdpHeader
*/
void SetDestination (uint16_t port);
/**
* \param port The source port for this UdpHeader
*/
void SetSource (uint16_t port);
/**
* \return The source port for this UdpHeader
*/
uint16_t GetSource (void) const;
/**
* \return the destination port for this UdpHeader
*/
uint16_t GetDestination (void) const;
/**
* \param size The payload size (XXX: in bytes?)
*/
void SetPayloadSize (uint16_t size);
void InitializeChecksum (Ipv4Address source,

View File

@ -36,16 +36,24 @@ class INode;
class TraceResolver;
class TraceContext;
class Socket;
/**
* \brief Implementation of the UDP protocol
*/
class Udp : public Ipv4L4Protocol {
public:
static const uint8_t PROT_NUMBER;
/**
* \brief Constructor
* \param node The node this protocol is associated with
*/
Udp (Ptr<INode> node);
virtual ~Udp ();
virtual TraceResolver *CreateTraceResolver (TraceContext const &context);
/**
* \return A smart Socket pointer to a UdpSocket, allocated by this instance
* of the UDP protocol
*/
Ptr<Socket> CreateSocket (void);
Ipv4EndPoint *Allocate (void);
@ -58,9 +66,23 @@ public:
void DeAllocate (Ipv4EndPoint *endPoint);
// called by UdpSocket.
/**
* \brief Send a packet via UDP
* \param packet The packet to send
* \param saddr The source Ipv4Address
* \param daddr The destination Ipv4Address
* \param sport The source port number
* \param dport The destination port number
*/
void Send (Packet packet,
Ipv4Address saddr, Ipv4Address daddr,
uint16_t sport, uint16_t dport);
/**
* \brief Recieve a packet up the protocol stack
* \param p The Packet to dump the contents into
* \param source The source's Ipv4Address
* \param destination The destinations Ipv4Address
*/
// inherited from Ipv4L4Protocol
virtual void Receive(Packet& p,
Ipv4Address const &source,