TDMA Emulator First report

Download Report

Transcript TDMA Emulator First report

TDMA Emulator - logic
The implementation of the logic the emulator mainly
based on five classes:
 Users
 Connections
 TDMAEmulator
 Sniffer/ Sender
 Use Jpcap: Java class package that allows Java applications
to capture and/or send packets to the network. Jpcap is
based on libpcap/winpcap and Raw Socket API. Therefore,
Jpcap is supposed to work on any OS on
which libpcap/winpcap has been implemented
TDMA Emulator – Mode of
operation

Mode of operation 1:
◦ The emulator enables connections to it, in order for users (clients/servers) to sign
in/out
◦ Activated by the user – the emulator listens to both networks traffic, the sniffer
chooses the packets destined to the other network (by inspecting the IP address)
and passes them along to the Emulator
◦ The emulator queues them in its buffer

Mode of operation 2:
◦ Emulator removes packets from the buffer in cyclic order, for each fetched packet
it transmits it to the appropriate network (sniffer replaces the Ethernet layer
according to IP layer)
◦ Each process of fetching and sending users packets from the buffer is limited
with configured time slot, whether the user use it (it has packets) or not the
configured time slot must pass before proceeding to the next user in the buffer
◦ Buffer size is constant and configurable, a user gets number of entries according
to its priority
Emulator components diagram
Users
Users
o packets : LinkedList<Packet>
o ID : String
o priority : int
o averageUsage : double
addPacket
getPacket
updateUsage
Manages the list of packets for each user.
 The class holds user's information, statistics
regarding packets sending and the a list of
packets that are to be sent.
 User is identified by IP address and the port
that the packets are to be sent from.

Connection
Connection
o tdma : TDMAEmulator
o listener : ServerSocket
o connection : Socket
listen
stopListening




Responsible for accepting new members to the
system or removing them.
Each user should register before using the system.
The connection listener can reject a connection if
the user is already registered or there is no place for
additional users.
The listener works till the stopListening function is
invoked.
TDMAEmulator
The managing class of
the system.
 It is responsible for
creating connections,
initiating sniffers,
managing all the users
and sending the
packets to their
destination.

o
o
o
o
o
TDMAEmulator
clientSniffer : Sniffer
serverSniffer : Sniffer
clientCon : Connection
serverCon : Connection
queue : LinkedList<Users>
addPacket
addUser
removeUser
listen
stopListening
transmit
sendPacket
TDMAEmulator (cont.)
The class implement the TDMA algorithm by
letting one user at a time to use the entire
bandwidth for a defined amount of time.
 Each user is given its time slot even if it doesn't
have any information to send.
 The class holds a queue of users, where for each
user it holds a collection of the packets this user
wants to send.

Client/Server – Class diagram
TDMAobject
connectToEmulator
disconnectFromEmulator
HTTPClient
connectToServer
disconnectFromServer
GetHTTP
Server
openFileAndSend
ListenToClient
HTTPServer
ListenToClient
TDMAobject:
A basic object that all the projects inherits from it.
 Connects/ disconnects from the emulator.

HttpClient:



Every instance sends requests to one server.
Reads the data from the server.
Update the results array - the time elapsed from sending
a request till all the file received by the client.
Server:



A basic Server object that all the servers inherits from it.
Sends data to client.
The listenToclient method is pure virtual – each type of
server implements it differently.
HttpServer:
Multithreaded server that listens to client requests.
 Sends the data according to the request.
 Data is sent according to the servers prio.
(num of slots given by the emulator)

Manager:
TDMAobject
o TDMAobjects.
o ResultsArray.
Init
sort_and_exe
CreateFtpClient
CreateFtpServer
The manager initiates the system according
to a configuration file.
 It manages the client and servers and saves
the results.
