A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
ipv4-end-point.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2005 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
21
#ifndef IPV4_END_POINT_H
22
#define IPV4_END_POINT_H
23
24
#include <stdint.h>
25
#include "ns3/ipv4-address.h"
26
#include "ns3/callback.h"
27
#include "ns3/net-device.h"
28
#include "ns3/ipv4-header.h"
29
#include "ns3/ipv4-interface.h"
30
31
namespace
ns3 {
32
33
class
Header;
34
class
Packet;
35
47
class
Ipv4EndPoint
{
48
public
:
49
Ipv4EndPoint
(
Ipv4Address
address, uint16_t
port
);
50
~Ipv4EndPoint
();
51
52
Ipv4Address
GetLocalAddress
(
void
);
53
void
SetLocalAddress
(
Ipv4Address
address);
54
uint16_t
GetLocalPort
(
void
);
55
Ipv4Address
GetPeerAddress
(
void
);
56
uint16_t
GetPeerPort
(
void
);
57
58
void
SetPeer
(
Ipv4Address
address, uint16_t port);
59
60
void
BindToNetDevice
(
Ptr<NetDevice>
netdevice);
61
Ptr<NetDevice>
GetBoundNetDevice
(
void
);
62
63
// Called from socket implementations to get notified about important events.
64
void
SetRxCallback
(
Callback
<
void
,
Ptr<Packet>
,
Ipv4Header
, uint16_t,
Ptr<Ipv4Interface>
> callback);
65
void
SetIcmpCallback
(
Callback<void,Ipv4Address,uint8_t,uint8_t,uint8_t,uint32_t>
callback);
66
void
SetDestroyCallback
(
Callback<void>
callback);
67
68
// Called from an L4Protocol implementation to notify an endpoint of a
69
// packet reception.
70
void
ForwardUp
(
Ptr<Packet>
p,
const
Ipv4Header
& header, uint16_t sport,
71
Ptr<Ipv4Interface>
incomingInterface);
72
// Called from an L4Protocol implementation to notify an endpoint of
73
// an icmp message reception.
74
void
ForwardIcmp
(
Ipv4Address
icmpSource, uint8_t icmpTtl,
75
uint8_t icmpType, uint8_t icmpCode,
76
uint32_t icmpInfo);
77
78
private
:
79
void
DoForwardUp
(
Ptr<Packet>
p,
const
Ipv4Header
& header, uint16_t sport,
80
Ptr<Ipv4Interface>
incomingInterface);
81
void
DoForwardIcmp
(
Ipv4Address
icmpSource, uint8_t icmpTtl,
82
uint8_t icmpType, uint8_t icmpCode,
83
uint32_t icmpInfo);
84
Ipv4Address
m_localAddr
;
85
uint16_t
m_localPort
;
86
Ipv4Address
m_peerAddr
;
87
uint16_t
m_peerPort
;
88
Ptr<NetDevice>
m_boundnetdevice
;
89
Callback<void,Ptr<Packet>
,
Ipv4Header
, uint16_t,
Ptr<Ipv4Interface>
>
m_rxCallback
;
90
Callback<void,Ipv4Address,uint8_t,uint8_t,uint8_t,uint32_t>
m_icmpCallback
;
91
Callback<void>
m_destroyCallback
;
92
};
93
94
}
// namespace ns3
95
96
97
#endif
/* IPV4_END_POINT_H */
src
internet
model
ipv4-end-point.h
Generated on Tue Oct 9 2012 16:45:38 for ns-3 by
1.8.1.2