Professional Documents
Culture Documents
What is KENS?
KAIST Educational Networking System
A programming environment to build and test network protocols
KENSv3 Features:
KENSv3 Framework
Install KENS
Visit and clone (and star!)
https://github.com/ANLAB-KAIST/KENSv3
Please DO NOT FORK
https://code.google.com/p/googletest/
http://askubuntu.com/questions/145887/why-no-library-files-installedfor-google-test
Components
Components
Components
Solution that evaluates your implementation
$./testTCP
$make test_part1
$make test_part2
$make test_part3
$make test_part4
10
11
Project #2
Get familiar with KENS
Implement open and bind
KENS Projects
Your job is to complete TCPAssignment.cpp & TCPAssignment.hpp
*** This project is incremental! ***
Your implementation on part1 will affect implementation of part2, and so on.
Project 2: KENS #1
Run reference solution
Implement socket, bind, getsockname and close
13
Requirement #1
Run reference solution (refer to slides #10)
Open TestCongestion1.pcap with Wireshark
Statistic->IO Graph
Something like this, but use different colors
14
Requirement #2
Implement your own socket()/bind()/getsockname()/close()
Tests to be completed
$make test_part1 (refer to slides #9)
For these tests, you should implement socket/bind/getsockname/close
functions
However, passing test does not guarantee the full score
15
Team Assignment
Make a team of 1 or 2 students
Notice about project team will be on KLMS tonight
Write your team member information in a reply
Name, student ID of each member
16
Deliverables
Report + TCPAssignment.cpp, TCPAssignment.hpp and other source files you implemented.
File name: {Team_no}_Project2.zip
Ex) 03_Project2.zip, 32_Project2.zip, ..
32_Project2/
- report_proj2.pdf
- KENS1/ - TCPAssignment.cpp
- TCPAssignment.hpp
- mycode.cpp <- optional
- mycode.hpp <- optional
Content of report
Format of report
17
Submission Guideline
Team assignment! (or you can choose to work alone)
Due: 2:29pm on Tue, 10/4
Late submission is NOT allowed!
Late submission will get 0 point
Submit on KLMS
18
KENS
You may not be familiar with the framework
Try really, really hard to understand how it works
Refer to KENS internals in the later section
Please, read carefully!!
Recommendations:
See how test cases work
Understand how socket APIs work
Refer to Project #1 slides supplementary material
20
testopen.cpp
21
testopen.cpp
22
socket()/bind()/getsockname()/close()
Does not actually generate network packets
Internal file descriptor/context management
Internal address management logic
Be familiar with KENS
23
Bind rule
Passive socket (server socket): need explicit bind
Active socket (client socket): need implicit bind
Address is consist of ip_address and port_number (sockaddr_in)
143.248.234.2:5555 and 10.0.0.2:5555 do not overlap
143.248.234.2:5555 and 0.0.0.0:5555 overlap (INADDR_ANY)
143.248.234.2:5555 and 143.248.234.3:5555 do not overlap
0.0.0.0:5555 and 0.0.0.0:5556 do not overlap (different port)
Closed sockets do not overlap with any socket
24
Context management
Implement bind rule for your bind
Will pass $make test_part1
Suggestion:
Make a global bound contexts list
Save whether a context is bound
Save the bounded address and port
25
Recommended books
TCP/IP Illrustrated, Vol 2, Stevens
Book about the actual implementation of TCP
26
KENS Internals
Supplementary Material
What is KENS?
KAIST Educational Networking System
A programming environment to build and test network protocols
KENSv3 Features:
28
KENSv3 Framework
29
KENSv3 Dataflow
Components
31
Components
32
Components
33
Components
Solution that evaluates your implementation
34
Convention
Packet :
If you have a packet (either received or allocated), you have to free it, or
pass it to other network module
Message:
If you allocated a message, you have to free it by yourselves
i.e. if you received a message, do not free it
If message is passed to the receiver, messageFinished callback or
messageCanceled are called to notify that the message is to be freed.
Detailed documentation at
http://anlab-kaist.github.io/KENSv3/doxygen/
35
HostModule
HostModule(std::string name, Host* host);
host: Host to insert this module
name: this modules name
Have to implement:
packetArrived(from_where, packet)
If IP layer passed the packet, from_where = IP
Optional implementation:
initialize(): automatically before host starts
finalize(): automatically when TCP have to clean up
36
HostModule
Provided utilities
(you can use them after you inherit this class)
(however, you cannot override them)
sendPacket(module_name, packet)
ex) sendPacket(IP, packet)
name is defined via HostModule(name, host)
getHost()
Current time (getCurrentTime)
Routing information
37
NetworkModule
You can allocate/deallocate packets
Provided utilities
38
39
40
TimerModule
timerCallback(void* payload)
Automatically called with given paramter
cancelTimer(UUID key)
Cancel the timer with the identifier
41
https://github.com/ANLAB-KAIST/KENSv3
42