TDMA Emulator - logic The implementation of the logic the emulator mainly based on five classes:...
-
Upload
sharlene-byrd -
Category
Documents
-
view
219 -
download
0
description
Transcript of TDMA Emulator - logic The implementation of the logic the emulator mainly based on five classes:...
![Page 1: TDMA Emulator - logic The implementation of the logic the emulator mainly based on five classes: Users Connections TDMAEmulator Sniffer/ Sender Use Jpcap:](https://reader036.fdocuments.in/reader036/viewer/2022082600/5a4d1b497f8b9ab0599a4d73/html5/thumbnails/1.jpg)
TDMA Emulator - logic The implementation of the logic the emulator mainly
based on five classes:UsersConnectionsTDMAEmulatorSniffer/ 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
![Page 2: TDMA Emulator - logic The implementation of the logic the emulator mainly based on five classes: Users Connections TDMAEmulator Sniffer/ Sender Use Jpcap:](https://reader036.fdocuments.in/reader036/viewer/2022082600/5a4d1b497f8b9ab0599a4d73/html5/thumbnails/2.jpg)
TDMA Emulator – Mode of TDMA Emulator – Mode of operationoperationMode 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
![Page 3: TDMA Emulator - logic The implementation of the logic the emulator mainly based on five classes: Users Connections TDMAEmulator Sniffer/ Sender Use Jpcap:](https://reader036.fdocuments.in/reader036/viewer/2022082600/5a4d1b497f8b9ab0599a4d73/html5/thumbnails/3.jpg)
Emulator components diagramEmulator components diagram
![Page 4: TDMA Emulator - logic The implementation of the logic the emulator mainly based on five classes: Users Connections TDMAEmulator Sniffer/ Sender Use Jpcap:](https://reader036.fdocuments.in/reader036/viewer/2022082600/5a4d1b497f8b9ab0599a4d73/html5/thumbnails/4.jpg)
Users
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.
Userso packets : LinkedList<Packet>o ID : Stringo priority : into averageUsage : doubleaddPacketgetPacketupdateUsage
![Page 5: TDMA Emulator - logic The implementation of the logic the emulator mainly based on five classes: Users Connections TDMAEmulator Sniffer/ Sender Use Jpcap:](https://reader036.fdocuments.in/reader036/viewer/2022082600/5a4d1b497f8b9ab0599a4d73/html5/thumbnails/5.jpg)
Connection
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.
Connectiono tdma : TDMAEmulatoro listener : ServerSocketo connection : SocketlistenstopListening
![Page 6: TDMA Emulator - logic The implementation of the logic the emulator mainly based on five classes: Users Connections TDMAEmulator Sniffer/ Sender Use Jpcap:](https://reader036.fdocuments.in/reader036/viewer/2022082600/5a4d1b497f8b9ab0599a4d73/html5/thumbnails/6.jpg)
TDMAEmulatorThe managing class of
the system.It is responsible for
creating connections, initiating sniffers, managing all the users and sending the packets to their destination.
TDMAEmulatoro clientSniffer : Sniffero serverSniffer : Sniffero clientCon : Connectiono serverCon : Connectiono queue : LinkedList<Users>
addPacketaddUserremoveUserlistenstopListeningtransmitsendPacket
![Page 7: TDMA Emulator - logic The implementation of the logic the emulator mainly based on five classes: Users Connections TDMAEmulator Sniffer/ Sender Use Jpcap:](https://reader036.fdocuments.in/reader036/viewer/2022082600/5a4d1b497f8b9ab0599a4d73/html5/thumbnails/7.jpg)
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.
![Page 8: TDMA Emulator - logic The implementation of the logic the emulator mainly based on five classes: Users Connections TDMAEmulator Sniffer/ Sender Use Jpcap:](https://reader036.fdocuments.in/reader036/viewer/2022082600/5a4d1b497f8b9ab0599a4d73/html5/thumbnails/8.jpg)
Client/Server – Class diagramClient/Server – Class diagram
TDMAobjectconnectToEmulatordisconnectFromEmulator
HTTPClientconnectToServerdisconnectFromServerGetHTTP
HTTPServerListenToClient
ServeropenFileAndSendListenToClient
![Page 9: TDMA Emulator - logic The implementation of the logic the emulator mainly based on five classes: Users Connections TDMAEmulator Sniffer/ Sender Use Jpcap:](https://reader036.fdocuments.in/reader036/viewer/2022082600/5a4d1b497f8b9ab0599a4d73/html5/thumbnails/9.jpg)
TDMAobject:TDMAobject:A basic object that all the projects inherits from it.Connects/ disconnects from the emulator.
HttpClient: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.
![Page 10: TDMA Emulator - logic The implementation of the logic the emulator mainly based on five classes: Users Connections TDMAEmulator Sniffer/ Sender Use Jpcap:](https://reader036.fdocuments.in/reader036/viewer/2022082600/5a4d1b497f8b9ab0599a4d73/html5/thumbnails/10.jpg)
Server: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: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)
![Page 11: TDMA Emulator - logic The implementation of the logic the emulator mainly based on five classes: Users Connections TDMAEmulator Sniffer/ Sender Use Jpcap:](https://reader036.fdocuments.in/reader036/viewer/2022082600/5a4d1b497f8b9ab0599a4d73/html5/thumbnails/11.jpg)
Manager:Manager:
The manager initiates the system according to a configuration file.
It manages the client and servers and saves the results.
TDMAobjecto TDMAobjects.o ResultsArray.Initsort_and_exeCreateFtpClient CreateFtpServer