Introduction to Network Simulator NS2 (eBook)

eBook Download: PDF
2011 | 2nd ed. 2012
XXIV, 512 Seiten
Springer US (Verlag)
978-1-4614-1406-3 (ISBN)

Lese- und Medienproben

Introduction to Network Simulator NS2 -  Ekram Hossain,  Teerawat Issariyakul
Systemvoraussetzungen
106,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen
Introduction to Network Simulator NS2 is a primer providing materials for NS2 beginners, whether students, professors, or researchers for understanding the architecture of Network Simulator 2 (NS2) and for incorporating simulation modules into NS2. The authors discuss the simulation architecture and the key components of NS2 including simulation-related objects, network objects, packet-related objects, and helper objects. The NS2 modules included within are nodes, links, SimpleLink objects, packets, agents, and applications. Further, the book covers three helper modules: timers, random number generators, and error models. Also included are chapters on summary of debugging, variable and packet tracing, result compilation, and examples for extending NS2. Two appendices provide the details of scripting language Tcl, OTcl and AWK, as well object oriented programming used extensively in NS2.
Introduction to Network Simulator NS2 is a primer providing materials for NS2 beginners, whether students, professors, or researchers for understanding the architecture of Network Simulator 2 (NS2) and for incorporating simulation modules into NS2. The authors discuss the simulation architecture and the key components of NS2 including simulation-related objects, network objects, packet-related objects, and helper objects. The NS2 modules included within are nodes, links, SimpleLink objects, packets, agents, and applications. Further, the book covers three helper modules: timers, random number generators, and error models. Also included are chapters on summary of debugging, variable and packet tracing, result compilation, and examples for extending NS2. Two appendices provide the details of scripting language Tcl, OTcl and AWK, as well object oriented programming used extensively in NS2.

Introduction to Network Simulator NS2 3
Preface 7
Acknowledgment 13
Contents 15
Chapter1 Simulation of Computer Networks 25
1.1 Computer Networks and the Layering Concept 25
1.1.1 Layering Concept 26
1.1.2 OSI and TCP/IP Reference Models 28
1.1.2.1 Application Layer 28
1.1.2.2 Transport Layer 28
1.1.2.3 Network Layer 29
1.1.2.4 Link Layer 29
1.1.2.5 Physical Layer 29
1.2 System Modeling 29
1.2.1 Analytical Approach 30
1.2.2 Simulation Approach 30
1.3 Basics of Computer Network Simulation 30
1.3.1 Simulation Components 31
1.3.1.1 Entities 31
1.3.1.2 Resources 32
1.3.1.3 Activities and Events 32
1.3.1.4 Scheduler 32
1.3.1.5 State and Global Variables 32
1.3.1.6 Random Number Generator 32
1.3.1.7 Statistics Gatherer 33
1.3.2 Simulation Performance 33
1.3.3 Confidence Interval 33
1.3.4 Choices for Network Simulation Tools 33
1.3.4.1 Simulation Platform 34
1.3.4.2 Types of Simulation Tools 34
1.3.4.3 User Interface 35
1.3.4.4 Examples of Simulation Tools 35
1.4 Time-Dependent Simulation 35
1.4.1 Time-Driven Simulation 36
1.4.2 Event-Driven Simulation 37
1.5 A Simulation Example: A Single-Channel Queuing System 38
1.5.1 Entities 38
1.5.2 State Global Variables 39
1.5.3 Resource 39
1.5.4 Events 39
1.5.5 Simulation Performance Measures and Statistics Gatherers 40
1.5.6 Simulation Program 40
1.6 Chapter Summary 43
1.7 Exercises 44
Chapter2 Introduction to Network Simulator 2 (NS2) 45
2.1 Introduction 45
2.2 Basic Architecture 46
2.3 Installation 47
2.3.1 Installing an All-In-One NS2 Suiteon Unix-Based Systems 48
2.3.2 Installing an All-In-One NS2 Suiteon Windows-Based Systems 48
2.4 Directories and Convention 49
2.4.1 Directories 49
2.4.2 Convention 49
2.4.2.1 Terminology 49
2.4.2.2 Notations 50
2.5 Running NS2 Simulation 51
2.5.1 NS2 Program Invocation 51
2.5.2 Main NS2 Simulation Steps 52
2.6 A Simulation Example 53
2.7 Including C++ Modules into NS2 and the make Utility 59
2.7.1 An Invocation of a make Utility 59
2.7.2 A make Descriptor File 59
2.7.3 NS2 Descriptor File 62
2.8 Chapter Summary 62
2.9 Exercises 63
Chapter3 Linkage Between OTcl and C++ in NS2 65
3.1 The Two-Language Concept in NS2 66
3.1.1 The Natures of OTcl and C++ Programming Languages 66
3.1.2 C++ Programming Styles and Its Applicationin NS2 67
3.1.2.1 Basic C++ Programming 67
3.1.2.2 C++ Programming with Input Arguments 68
3.1.2.3 C++ Programming with Configuration Files 69
3.2 Class Binding 70
3.2.1 Class Binding Process 70
3.2.2 Defining Your Own Class Binding 71
3.2.3 Naming Convention for Class TclClass 72
3.3 Variable Binding 72
3.3.1 Variable Binding Methodology 72
3.3.2 Setting the Default Values 73
3.3.3 NS2 Data Types 74
3.3.3.1 Real and Integer Variables 74
3.3.3.2 Bandwidth 74
3.3.3.3 Time 75
3.3.3.4 Boolean 75
3.3.4 Class Instvar 77
3.4 Execution of C++ Statements from the OTcl Domain 77
3.4.1 OTcl Commands in a Nutshell 77
3.4.1.1 OTcl Command Invocation 77
3.4.1.2 C++ Definition of OTcl Commands 78
3.4.1.3 Creating Your Own OTcl Commands 78
3.4.2 The Internal Mechanism of OTcl Commands 79
3.4.2.1 OTcl Command Invocation Mechanism 79
3.4.2.2 OTcl Default Returning Structure 80
3.4.2.3 Interpretation of the Returned Values 80
3.4.3 An Alternative for OTcl Command Invocation 83
3.4.4 Non-OOP Tcl Command 83
3.4.5 Invoking a TclCommand 83
3.4.5.1 Creating a TclCommand 84
3.4.5.2 Defining Your Own TclCommand 85
3.5 Shadow Object Construction Process 86
3.5.1 A Handle of a TclObject 86
3.5.2 TclObjects Construction Process 87
3.5.3 TclObjects Destruction Process 91
3.6 Access the OTcl Domain from the C++ Domain 91
3.6.1 Obtain a Reference to the Tcl Interpreter 92
3.6.2 Execution of Tcl Statements 92
3.6.3 Pass or Receive Results to/from the Interpreter 93
3.6.3.1 Passing Results to the OTcl Domain 93
3.6.3.2 Retrieving Results from the OTcl Domain 94
3.6.4 TclObject Reference Retrieval 95
3.7 Translation of Tcl Code 96
3.8 Chapter Summary 97
3.9 Exercises 97
Chapter4 Implementation of Discrete-Event Simulation in NS2 100
4.1 NS2 Simulation Concept 100
4.2 Events and Handlers 101
4.2.1 An Overview of Events and Handlers 101
4.2.2 Class Object: A Child Class of ClassHandler 102
4.2.3 Classes Packet and AtEvent: Child Classes of Class Event 103
4.3 The Scheduler 105
4.3.1 Main Components of the Scheduler 105
4.3.2 Data Encapsulation and Polymorphism Concepts 105
4.3.3 Main Functions of the Scheduler 106
4.3.4 Two Auxiliary Functions 108
4.3.5 Dynamics of the Unique ID of an Event 109
4.3.6 Scheduling–Dispatching Mechanism 109
4.3.7 Null Event and Dummy Event Scheduling 111
4.3.7.1 Scheduling of a Null Event 111
4.3.7.2 Scheduling of a Dummy Event 111
4.4 The Simulator 112
4.4.1 Main Components of a Simulation 112
4.4.1.1 Interperted Hierarchy 112
4.4.1.2 Compiled Hierarchy 113
4.4.2 Retrieving the Instance of the Simulator 113
4.4.3 Simulator Initialization 114
4.4.4 Running Simulation 115
4.4.5 Instprocs of OTcl Class Simulator 116
4.5 Chapter Summary 116
4.6 Exercises 117
Chapter5 Network Objects: Creation, Configuration,and Packet Forwarding 119
5.1 Overview of NS2 Components 120
5.1.1 Functionality-Based Classification of NS2 Modules 120
5.1.2 C++ Class Hierarchy 120
5.2 NsObjects: A Network Object Template 122
5.2.1 ClassNsObject 122
5.2.2 Packet Forwarding Mechanism of NsObjects 123
5.3 Connectors 123
5.3.1 Class Declaration 124
5.3.2 OTcl Configuration Commands 125
5.3.3 Packet Forwarding Mechanism of Connectors 128
5.3.3.1 Immediate Packet Forwarding 128
5.3.3.2 Delayed Packet Forwarding 128
5.4 Chapter Summary 130
5.5 Exercises 131
Chapter6 Nodes as Routers or Computer Hosts 132
6.1 An Overview of Nodes in NS2 132
6.1.1 Routing Concept and Terminology 132
6.1.2 Architecture of a Node 133
6.1.3 Default Nodes and Node Configuration Interface 134
6.2 Classifiers: Multi-Target Packet Forwarders 135
6.2.1 Class Classifier and Its Main Components 135
6.2.1.1 C++ Variables 135
6.2.1.2 C++ Functions 136
6.2.1.3 Main Configuring Interface 137
6.2.1.4 Main Internal Mechanism 137
6.2.2 Port Classifiers 139
6.2.3 Hash Classifiers 140
6.2.3.1 An Overview of Hash Classifiers 140
6.2.3.2 C++ Implementation of Class HashClassifier 141
6.2.3.3 Child Classes of Class HashClassifier 143
6.2.3.4 C++ ClassDestHashClassifier 143
6.2.4 Creating Your Own Classifiers 146
6.3 Routing Modules 146
6.3.1 An Overview of Routing Modules 146
6.3.2 C++ Class RoutingModule 147
6.3.3 OTcl Class RtModule 150
6.3.3.1 Initialization Instprocs 150
6.3.3.2 Instprocs for Configuring Classifiers 151
6.3.4 Built-in Routing Modules 152
6.3.4.1 The List of Built-in Routing Modules 152
6.3.4.2 C++ Class BaseRoutingModule and OTcl Class RtModule/Base 152
6.4 Route Logic 153
6.4.1 C++ Implementation 153
6.4.2 OTcl Implementation 154
6.5 Node Construction and Configuration 155
6.5.1 Key Variables of the OTcl Class Nodeand Their Relationship 156
6.5.1.1 Routing-Related Instvars 156
6.5.1.2 Classifier-Related Instvars 157
6.5.2 Installing Classifiers in a Node 158
6.5.3 Bridging a Node to a Transport Layer Protocol 159
6.5.4 Adding/Deleting a Routing Rule 161
6.5.5 Node Construction and Configuration 161
6.5.5.1 Node Construction 162
6.5.5.2 Agent and Route Configuration 164
6.6 Chapter Summary 168
6.7 Exercises 169
Chapter7 Link and Buffer Management 171
7.1 Introduction to SimpleLink Objects 171
7.1.1 Main Components of a SimpleLink 171
7.1.1.1 Basic Objects 172
7.1.1.2 Tracing Objects 172
7.1.2 Instprocs for Configuring a SimpleLink Object 173
7.1.3 The Constructor of Class SimpleLink 174
7.2 Modeling Packet Departure 175
7.2.1 Packet Departure Mechanism 175
7.2.2 C++ Class LinkDelay 176
7.3 Buffer Management 178
7.3.1 Class PacketQueue: A Model for Packet Buffering 179
7.3.2 Queue Handler 180
7.3.3 Queue Blocking and Callback Mechanism 181
7.3.3.1 Queue Blocking 181
7.3.3.2 Callback Mechanism 181
7.3.4 Class DropTail: A Child Class of Class Queue 183
7.4 A Sample Two-Node Network 185
7.4.1 Network Construction 185
7.4.2 Packet Flow Mechanism 185
7.5 Chapter Summary 186
7.6 Exercises 187
Chapter8 Packets, Packet Headers, and Header Format 188
8.1 An Overview of Packet Modeling Principle 188
8.1.1 Packet Architecture 188
8.1.2 A Packet as an Event: A Delayed Packet Reception Event 191
8.1.3 A Link List of Packets 192
8.1.4 Free Packet List 193
8.2 Packet Allocation and Deallocation 194
8.2.1 Packet Allocation 194
8.2.2 Packet Deallocation 197
8.3 Packet Header 199
8.3.1 An Overview of First Level Packet Composition: Offseting Protocol-Specific Header on the Packet Header 200
8.3.2 Common Packet Header 201
8.3.3 IP Packet Header 202
8.3.4 Payload Type 203
8.3.5 Protocol-Specific Headers 205
8.3.5.1 Protocol-Specific Header C++ Classes 205
8.3.5.2 A Protocol-Specific Header OTcl Class 206
8.3.5.3 A Protocol-Specific Header Mapping Class 206
8.3.6 Packet Header Access Mechanism 209
8.3.6.1 Retrieving a Reference to Protocol-Specific Header 209
8.3.6.2 Accessing Packet Attributes in a Protocol-Specific Header 211
8.3.7 Packet Header Manager 212
8.3.8 Protocol-Specific Header Compositionand Packet Header Construction 213
8.4 Data Payload 219
8.5 Customizing Packets 221
8.5.1 Creating Your Own Packet 221
8.5.1.1 Defining a New Packet Header 222
8.5.1.2 Defining a New Data Payload 223
8.5.2 Activate/Deactivate a Protocol-Specific Header 224
8.6 Chapter Summary 225
8.7 Exercises 226
Chapter9 Transport Control Protocols Part 1: An Overview and User Datagram Protocol Implementation 228
9.1 UDP and TCP Basics 228
9.1.1 UDP Basics 228
9.1.2 TCP Basics 229
9.1.2.1 Error Control Using Basic Acknowledgment and Timeout 230
9.1.2.2 Window-Based Congestion Control 231
9.1.2.3 TCP Variants 233
9.2 Basic Agents 233
9.2.1 Applications, Agents, and a Low-Level Network 234
9.2.2 Agent Configuration 236
9.2.3 Internal Mechanism for Agents 237
9.2.3.1 Related C++ and OTcl Variables 237
9.2.3.2 Key C++ Functions 237
9.2.4 Guidelines to Define a New Transport Layer Agent 241
9.3 UDP and Null Agents 241
9.3.1 Null (Receiving) Agents 241
9.3.2 UDP (Sending) Agent 242
9.3.3 Setting Up a UDP Connection 246
9.4 Chapter Summary 246
9.5 Exercises 247
Chapter10 Transport Control Protocols Part 2:Transmission Control Protocol 248
10.1 An Overview of TCP Agents in NS2 248
10.1.1 Setting Up a TCP Connection 248
10.1.2 Packet Transmission and AcknowledgmentMechanism 249
10.1.3 TCP Header 250
10.1.4 Defining TCP Sender and Receiver 250
10.1.4.1 Step 3: Implement the Constructor 251
10.2 TCP Receiver 254
10.2.1 Class Acker 256
10.2.2 Class TcpSink 259
10.3 TCP Sender 261
10.4 TCP Packet Transmission Functions 261
10.4.1 Function sendmsg(nbytes) 262
10.4.2 Function send_much(force,reason,maxburst) 263
10.4.3 Function output(seqno,reason) 265
10.4.4 Function send_one() 267
10.5 ACK Processing Functions 268
10.5.1 Function recv(p,h) 269
10.5.2 Functionrecv_newack_helper(pkt) 270
10.5.3 Function newack(pkt) 272
10.5.4 Function dupack_action() 272
10.6 Timer-Related Functions 273
10.6.1 RTT Sample Collection 273
10.6.2 RTT Estimation 275
10.6.3 Overview of State Variables 276
10.6.4 Retransmission Timer 277
10.6.5 Function Overview 278
10.6.6 Function rtt_update(tao) 279
10.6.7 Function rtt_timeout() 281
10.6.8 Function rtt_backoff() 282
10.6.9 Function set_rtx_timer() and Function reset_rtx_timer( mild,backoff) 283
10.6.10 Function newtimer(pkt) 283
10.6.11 Function timeout(tno) 284
10.7 Window Adjustment Functions 286
10.7.1 Function opencwnd() 287
10.7.2 Function slowdown(how) 288
10.8 Chapter Summary 290
10.9 Exercises 290
Chapter11 Application: User Demand Indicator 292
11.1 Relationship Between an Application and a Transport Layer Agent 292
11.2 Applications 295
11.2.1 Functions of Classes Application and Agent 296
11.2.2 Public Functions of Class Application 297
11.2.3 Related Public Functions of Class Agent 299
11.2.4 OTcl Commands of Class Application 299
11.3 Traffic Generators 299
11.3.1 An Overview of Class TrafficGenerator 300
11.3.2 Main Mechanism of a Traffic Generator 302
11.3.3 Built-in Traffic Generators in NS2 303
11.3.3.1 Constant Bit Rate (CBR) Traffic 303
11.3.3.2 Exponential On/Off Traffic 304
11.3.3.3 Pareto On/Off Traffic 304
11.3.3.4 Traffic Trace 305
11.3.4 Class CBR_Traffic: An Example TrafficGenerator 306
11.4 Simulated Applications 308
11.4.1 File Transfer Protocol 309
11.4.2 Telnet 309
11.5 Chapter Summary 310
11.6 Exercises 311
Chapter12 Wireless Mobile Ad Hoc Networks 312
12.1 An Overview of Wireless Networking 313
12.1.1 Mobile Node 313
12.1.2 Architecture of Mobile Node 313
12.1.2.1 Regular Node Part 314
12.1.2.2 Mobile Extension Part 315
12.1.3 General Packet Flow in a Wireless Network Implementation 316
12.1.4 Mobile Node Configuration Process 317
12.1.4.1 Step 1: Mobile Node configuration 318
12.1.4.2 Step 2: Mobile Node Construction 320
12.2 Network Layer: Routing Agents and Routing Protocols 324
12.2.1 Preliminaries for the AODV Routing Protocol 324
12.2.1.1 Terminology 324
12.2.1.2 Packet Types 325
12.2.2 The Principles of AODV 325
12.2.2.1 Route Discovery: Identifying a Route to the Destination 326
12.2.2.2 Route and Neighbor Maintenance 327
12.2.3 An Overview of AODV Implementation in NS2 327
12.2.3.1 File and Class Structure 328
12.2.3.2 Route Entries and Packet Header 329
12.2.4 AODV Routing Agent Construction Process 330
12.2.5 General Packet Flow Mechanismin a Wireless Network 331
12.2.6 Packet Reception and Processing Function of AODV 331
12.2.7 AODV Time-Driven Actions 332
12.3 Data Link Layer: Link Layer Models, Address Resolution Protocols, and Interface Queues 334
12.3.1 Link Layer Objects 334
12.3.2 Address Resolution Protocol 334
12.3.3 Interface Queues 336
12.4 Medium Access Control Layer: IEEE 802.11 336
12.4.1 Description of IEEE 802.11 MAC Protocol 337
12.4.2 NS2 Classes Mac and Mac802_11 338
12.4.3 Basic Functions of NS2 Classes Macand Mac802_11 340
12.4.4 Timer Concepts for Implementation of IEEE 802.11 342
12.4.5 Packet Reception Mechanism of IEEE 802.11 342
12.4.6 Implementation of Packet Retransmission in NS2 345
12.4.7 Implementation of Carrier-Sensing, Backoff, and NAV 348
12.4.7.1 Basic Carrier Sensing 348
12.4.7.2 Pausing and Resuming Backoff Timer 349
12.4.7.3 Network Allocation Vector 350
12.5 Physical Layer: Physical Network Interfaces and Channel 350
12.5.1 Physical Network Interface 350
12.5.2 Wireless Channels 352
12.5.3 Sender Operations at the Physical Layer 352
12.5.4 Receiver Operations at the Physical Layer 353
12.6 An Introduction to Node Mobility 356
12.6.1 Basic Mobility Configuration 356
12.6.2 General Operation Director 357
12.6.3 Random Mobility 358
12.6.4 Mobility and Traffic Generators: Standalone Helper Utility 359
12.6.4.1 Mobility Generation Utility ``setdest' 360
12.6.4.2 Traffic Generation Utility ``cbrgen.tcl' 361
12.6.4.3 Working with Scenario Files 362
12.7 Chapter Summary 362
12.8 Exercises 363
Chapter13 Developing New Modules for NS2 364
13.1 Automatic Repeat reQuest 364
13.1.1 The Design 365
13.1.1.1 Architecture 365
13.1.1.2 Packet Forwarding Mechanism 366
13.1.1.3 Callback Mechanism 366
13.1.2 C++ Implementation 367
13.1.2.1 Class ARQTxs 368
13.1.2.2 Class ARQHandler 369
13.1.2.3 Classes ARQRx, ARQAcker, and ARQNacker 369
13.1.2.4 Callback Mechanism 369
13.1.2.5 Packet Forwarding Mechanism 371
13.1.2.6 Processing ACK and NACK Messages 371
13.1.2.7 Actions and Status of ARQ Transmitters 373
13.1.3 OTcl Implementation 373
13.1.3.1 Instproc SimpleLink::link-arq{limit} 374
13.1.3.2 Instproc Simulator::link-arq{limit from to} 374
13.1.4 ARQ Under a Delayed (Error-Free) Feedback Channel 376
13.1.4.1 Function recv(p,h) of ARQ Receivers 376
13.1.4.2 Binding Variable delay_ 377
13.1.4.3 Configuration in the OTcl Domain 377
13.2 Packet Scheduling for Multi-Flow Data Transmission 378
13.2.1 The Design 378
13.2.1.1 Architecture of a SimpleLink with a Packet Scheduler 378
13.2.1.2 Packet Forwarding and Callback Mechanism 379
13.2.2 C++ Implementation 379
13.2.2.1 Class FlowClassifier 379
13.2.2.2 Class PktScheduler 380
13.2.2.3 Class RRScheduler 382
13.2.3 OTcl Implementation 382
13.2.3.1 Instproc insert-sched {num_queues} of class SimpleLink 383
13.2.3.2 Instproc insert-sched-to-SL{from to num_queues} of class Simulator 384
13.3 Chapter Summary 386
13.4 Exercises 387
Chapter14 Postsimulation Processing: Debugging, Tracing, and Result Compilation 388
14.1 Debugging: A Process to Remove Programming Errors 388
14.1.1 Types of Programming Errors 388
14.1.1.1 Compilation Errors (C++ Only) 389
14.1.1.2 Runtime Errors 389
14.1.2 Debugging Guidelines 390
14.2 Variable Tracing 393
14.2.1 Activation Process for Variable Tracing 393
14.2.2 Traceable Variable 394
14.2.3 Components and Architecture for Variable Tracing 395
14.2.3.1 TclObjects 395
14.2.3.2 Traceable Variables: OTcl Linkage 396
14.2.3.3 Traceable Variables: Tracing Capability 397
14.2.3.4 Tracers 397
14.2.3.5 Trace Channels 400
14.2.3.6 Trace Files and Trace Format 400
14.2.4 Tracing in Action: An Example of Class TcpAgent 400
14.2.5 Setting Up Variable Tracing 400
14.2.5.1 Specifying Traceable Variables 401
14.2.5.2 Attaching a Trace File to a Tracer 402
14.3 Packet Tracing 403
14.3.1 OTcl Configuration Interfaces 404
14.3.2 C++ Main Packet Tracing Class Trace 408
14.3.2.1 Main C++ Variable of Class Trace 408
14.3.2.2 Main C++ Functions of Class Trace 408
14.3.2.3 Main OTcl Commands of a Packet Tracing Object 410
14.3.3 C++ Helper Class BaseTrace 411
14.3.4 Various Types of Packet Tracing Objects 413
14.3.5 Format of Trace Strings for Packet Tracing 416
14.3.5.1 Normal Packet Trace Format 416
14.3.5.2 Wireless Packet Trace Format 418
14.3.5.3 New Wireless Trace Format 419
14.4 Compilation of Simulation Results 421
14.5 Chapter Summary 425
14.6 Exercises 426
Chapter15 Related Helper Classes 428
15.1 Timers 428
15.1.1 Implementation Concept of Timer in NS2 428
15.1.2 OTcl Implementation 430
15.1.3 C++ Class Implementation 432
15.1.3.1 Timer Life Cycle 432
15.1.3.2 Brief Overview of Class TimerHandler 433
15.1.3.3 Internal Waiting Mechanism 435
15.1.3.4 Expiration Actions 436
15.1.3.5 Interface Functions to Start, Restart, and Cancel a Timer 436
15.1.3.6 Cross-Referencing a Timer with Another Object 438
15.1.4 Guidelines for Implementing Timers in NS2 442
15.2 Implementation of Random Numbers in NS2 443
15.2.1 Random Number Generation 443
15.2.2 Seeding a Random Number Generator 444
15.2.3 OTcl and C++ Implementation 446
15.2.3.1 OTcl Commands and Instprocs 446
15.2.3.2 C++ Functions 447
15.2.4 Randomness in Simulation Scenarios 448
15.2.4.1 Deterministic Setting 448
15.2.4.2 Single-Stream Random Setting 448
15.2.4.3 Multiple-Stream Random Setting 448
15.2.5 Random Variables 450
15.2.5.1 Random Number Generator 451
15.2.5.2 OTcl Commands 451
15.2.5.3 Exponential Random Variable 452
15.2.6 Guidelines for Random Number Generation in NS2 453
15.3 Built-in Error Models 454
15.3.1 OTcl Implementation: Error Model Configuration 455
15.3.1.1 Parameter Configuration 456
15.3.1.2 Network Configuration 456
15.3.2 C++ Implementation: Error Model Simulation 459
15.3.2.1 Variables 459
15.3.2.2 Functions 461
15.3.2.3 Main Mechanism 462
15.3.2.4 Simulating Transmission Errors 463
15.3.3 Guidelines for Implementing a New Error Model in NS2 467
15.4 Bit Operations in NS2 468
15.4.1 Bit Masking 468
15.4.1.1 Subnet Masking 468
15.4.1.2 Modulo Masking 469
15.4.2 Bit Shifting and Decimal Multiplication 470
15.5 Chapter Summary 471
15.6 Exercises 471
A Programming Essentials 473
A.1 Tcl Programming 473
A.1.1 Program Invocation 473
A.1.2 Syntax 474
A.1.3 Variables and Basic Operations 475
A.1.4 Logical and Mathematical Operations 478
A.1.5 Control Structure 479
A.1.5.1 Repetition Structure 480
A.1.5.2 Jumping Structure 480
A.1.6 Modularization 481
A.1.6.1 Storing a Program Portion into a File and File Sourcing 481
A.1.6.2 Storing a Program Portion into a Procedure 481
A.1.6.3 Global and Local Variables 483
A.1.7 Advanced Input/Output: Files and Channels 483
A.1.7.1 Tcl Channels 484
A.1.8 Data Types 485
A.1.8.1 String 485
A.1.8.2 List 486
A.1.8.3 Associative Array 486
A.2 Objected-Oriented Tcl Programming 487
A.2.1 OTcl Language Structure 488
A.2.2 Classes and Inheritance 488
A.2.3 Objects and Object Construction Process 489
A.2.3.1 Object Construction Methods 489
A.2.3.2 Object Construction Process 489
A.2.4 Member Variables and Functions 490
A.2.4.1 Instance Variables 490
A.2.4.2 Instance Procedures 491
A.2.4.3 Non-Inheritable Members 492
A.2.5 A List of Useful Instance Procedures 492
A.3 AWK Programming 494
A.3.1 Program Invocation 495
A.3.2 An AWK Script 496
A.3.3 AWK Programming Structure 496
A.3.4 Pattern Matching 497
A.3.5 Basic Actions 497
A.3.5.1 Arithmetic Operation 498
A.3.5.2 Variables 498
A.3.5.3 Outputs 498
A.3.6 Redirection and Output to Files 499
A.3.7 Control Structure 500
A.4 Exercises 500
B A Review of the Polymorphism Concept in OOP 502
B.1 Fundamentals of Polymorphism 502
B.2 Type Casting and Function Ambiguity 505
B.3 Virtual Functions 506
B.4 Abstract Classes and Pure Virtual Functions 507
B.5 Class Composition: An Application of Type Casting Polymorphism 508
B.6 Programming Polymorphism with No Type Casting:An Example 509
B.7 A Scalability Problem Caused by Non-Type Casting Polymorphism 510
B.8 The Class Composition Programming Concept 511
C BSD Link List and Bit Level Functions 515
C.1 BSD Link List 515
C.2 Bit Level Functions 515
References 517
General Index 519
Code Index 523

Erscheint lt. Verlag 2.12.2011
Zusatzinfo XXIV, 512 p.
Verlagsort New York
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Netzwerke
Mathematik / Informatik Informatik Web / Internet
Technik Elektrotechnik / Energietechnik
Technik Maschinenbau
Technik Nachrichtentechnik
ISBN-10 1-4614-1406-7 / 1461414067
ISBN-13 978-1-4614-1406-3 / 9781461414063
Haben Sie eine Frage zum Produkt?
Wie bewerten Sie den Artikel?
Bitte geben Sie Ihre Bewertung ein:
Bitte geben Sie Daten ein:
PDFPDF (Wasserzeichen)
Größe: 4,4 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Das umfassende Handbuch

von Martin Linten; Axel Schemberg; Kai Surendorf

eBook Download (2023)
Rheinwerk Computing (Verlag)
29,90
das Praxisbuch für Administratoren und DevOps-Teams

von Michael Kofler

eBook Download (2023)
Rheinwerk Computing (Verlag)
39,90
Von den Grundlagen zur Funktion und Anwendung

von Rüdiger Schreiner; Oliver P. Waldhorst

eBook Download (2023)
Carl Hanser Verlag GmbH & Co. KG
29,99