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
udp-header.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 UDP_HEADER_H
22
#define UDP_HEADER_H
23
24
#include <stdint.h>
25
#include <string>
26
#include "ns3/header.h"
27
#include "ns3/ipv4-address.h"
28
#include "ns3/ipv6-address.h"
29
30
namespace
ns3 {
39
class
UdpHeader
:
public
Header
40
{
41
public
:
42
48
UdpHeader
();
49
~UdpHeader
();
50
54
void
EnableChecksums
(
void
);
58
void
SetDestinationPort
(uint16_t
port
);
62
void
SetSourcePort
(uint16_t port);
66
uint16_t
GetSourcePort
(
void
)
const
;
70
uint16_t
GetDestinationPort
(
void
)
const
;
71
83
void
InitializeChecksum
(
Address
source,
84
Address
destination,
85
uint8_t protocol);
86
98
void
InitializeChecksum
(
Ipv4Address
source,
99
Ipv4Address
destination,
100
uint8_t protocol);
101
113
void
InitializeChecksum
(
Ipv6Address
source,
114
Ipv6Address
destination,
115
uint8_t protocol);
116
117
static
TypeId
GetTypeId
(
void
);
118
virtual
TypeId
GetInstanceTypeId
(
void
)
const
;
119
virtual
void
Print
(std::ostream &os)
const
;
120
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
121
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
122
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start);
123
128
bool
IsChecksumOk
(
void
)
const
;
129
130
private
:
131
uint16_t
CalculateHeaderChecksum
(uint16_t size)
const
;
132
uint16_t
m_sourcePort
;
133
uint16_t
m_destinationPort
;
134
uint16_t
m_payloadSize
;
135
136
Address
m_source
;
137
Address
m_destination
;
138
uint8_t
m_protocol
;
139
bool
m_calcChecksum
;
140
bool
m_goodChecksum
;
141
};
142
143
}
// namespace ns3
144
145
#endif
/* UDP_HEADER */
src
internet
model
udp-header.h
Generated on Tue May 14 2013 11:08:23 for ns-3 by
1.8.1.2