NetSim Source Code Help
Loading...
Searching...
No Matches
Scheduling.c File Reference
#include "main.h"
#include "Scheduling.h"
#include "NetSim_Plot.h"
Include dependency graph for Scheduling.c:

Go to the source code of this file.

Macros

#define fnGetList(pstruPacketlist, Priority)   (pstruPacketlist+Priority/(Priority_High-Priority_Medium))
 

Enumerations

enum  enum_Buffer_Manipulation_Type { ADD = 1 , GET }
 

Functions

enum enum_BUFFER fn_NetSim_DropTail (NetSim_BUFFER *, NetSim_PACKET *)
 
enum enum_BUFFER fn_NetSim_RED (NetSim_BUFFER *, NetSim_PACKET *)
 
enum enum_BUFFER fn_NetSim_WRED (NetSim_BUFFER *, NetSim_PACKET *)
 
NetSim_PACKETfn_NetSim_Priority (NetSim_BUFFER *, NetSim_PACKET *, int, int)
 
NetSim_PACKETfn_NetSim_FIFO (NetSim_BUFFER *, NetSim_PACKET *, int, int)
 
NetSim_PACKETfn_NetSim_RoundRobin (NetSim_BUFFER *, NetSim_PACKET *, int, int)
 
NetSim_PACKETfn_NetSim_WFQ (NetSim_BUFFER *, NetSim_PACKET *, int, int)
 
NetSim_PACKETfn_NetSim_EDF (NetSim_BUFFER *, NetSim_PACKET *, int, int)
 
UINT64 fn_NetSim_GetPosition_MaximumNumber (UINT64 *nCount)
 
bool fn_NetSim_GetBufferStatus (NetSim_BUFFER *)
 
enum enum_BUFFER fn_NetSim_CheckBuffer (NetSim_BUFFER *, NetSim_PACKET *)
 
static void fn_NetSim_DropPackets (NetSim_BUFFER *, NetSim_PACKET *)
 
static void * init_buffer_plot (NETSIM_ID d, NETSIM_ID in)
 
enum enum_Buffer fn_NetSim_Queuing (NetSim_BUFFER *pstruBuffer, NetSim_PACKET *pstruData)
 
int fn_NetSim_Packet_AddPacketToBuffer (NetSim_BUFFER *pstruBuffer, NetSim_PACKET *pstruData)
 
NetSim_PACKETfn_NetSim_GetPacketFromBuffer (NetSim_BUFFER *pstruBuffer, int nFlag)
 
static void add_current_size_buffer (NetSim_BUFFER *pstruBuffer, NetSim_PACKET *pstruData)
 
static void reduce_current_size_buffer (NetSim_BUFFER *pstruBuffer, NetSim_PACKET *pstruData)
 
static enum enum_BUFFER red_algorithm (NetSim_BUFFER *pstruBuffer, NetSim_PACKET *pstruData)
 
static enum enum_BUFFER wred_algorithm (NetSim_BUFFER *pstruBuffer, NetSim_PACKET *pstruData, double max_th, double min_th, double max_p, int *count, double *random)
 
static void edf_algorithm_drop_expired_packets (NetSim_BUFFER *pstruBuffer)
 
static NetSim_PACKETedf_algorithm_get_earliest_deadline_packet (NetSim_BUFFER *pstruBuffer)
 

Macro Definition Documentation

◆ fnGetList

#define fnGetList (   pstruPacketlist,
  Priority 
)    (pstruPacketlist+Priority/(Priority_High-Priority_Medium))

Definition at line 11 of file Scheduling.c.

Enumeration Type Documentation

◆ enum_Buffer_Manipulation_Type

Enumerator
ADD 
GET 

Definition at line 6 of file Scheduling.c.

Function Documentation

◆ add_current_size_buffer()

static void add_current_size_buffer ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData 
)
static

Function is used to add packet size to of buffer

Definition at line 317 of file Scheduling.c.

Here is the caller graph for this function:

◆ edf_algorithm_drop_expired_packets()

static void edf_algorithm_drop_expired_packets ( NetSim_BUFFER pstruBuffer)
static

Helper function for EDF Scheduling Technique

Definition at line 788 of file Scheduling.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ edf_algorithm_get_earliest_deadline_packet()

static NetSim_PACKET * edf_algorithm_get_earliest_deadline_packet ( NetSim_BUFFER pstruBuffer)
static

Helper function for EDF Scheduling Technique

Definition at line 839 of file Scheduling.c.

Here is the caller graph for this function:

◆ fn_NetSim_CheckBuffer()

enum enum_BUFFER fn_NetSim_CheckBuffer ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData 
)

If the Current buffer size is greater than the Maximum buffer size --> Buffer Overflow Otherwise Buffer underflows.

Definition at line 276 of file Scheduling.c.

Here is the caller graph for this function:

◆ fn_NetSim_DropPackets()

static void fn_NetSim_DropPackets ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData 
)
static

Function for dropping packets

Definition at line 262 of file Scheduling.c.

Here is the caller graph for this function:

◆ fn_NetSim_DropTail()

enum enum_BUFFER fn_NetSim_DropTail ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData 
)

Queuing - Packets are dropped only when buffer is full

Definition at line 307 of file Scheduling.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fn_NetSim_EDF()

NetSim_PACKET * fn_NetSim_EDF ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData,
int  nType,
int  nFlag 
)

If the type is ADD, then all the packets will be added in the buffer based on arrival If the type is GET, then the expired packets are dropped from buffer and earliest deadline packet is served from the buffer

Definition at line 874 of file Scheduling.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fn_NetSim_FIFO()

NetSim_PACKET * fn_NetSim_FIFO ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData,
int  nType,
int  nFlag 
)

If the type is ADD, then all the packets will be added in the buffer based on the arrival If the type is GET, then the packets to be retrieved depends on the arrangement in the queue

Definition at line 577 of file Scheduling.c.

Here is the caller graph for this function:

◆ fn_NetSim_GetBufferStatus()

bool fn_NetSim_GetBufferStatus ( NetSim_BUFFER pstruBuffer)

This function is to check whether buffer list has any packet or not

Definition at line 41 of file Scheduling.c.

Here is the caller graph for this function:

◆ fn_NetSim_GetPacketFromBuffer()

NetSim_PACKET * fn_NetSim_GetPacketFromBuffer ( NetSim_BUFFER pstruBuffer,
int  nFlag 
)

This function is to get the packet from the buffer

Definition at line 168 of file Scheduling.c.

Here is the call graph for this function:

◆ fn_NetSim_GetPosition_MaximumNumber()

UINT64 fn_NetSim_GetPosition_MaximumNumber ( UINT64 nCount)

The function will get the array and it will return the Maximum number's position

Definition at line 243 of file Scheduling.c.

Here is the caller graph for this function:

◆ fn_NetSim_Packet_AddPacketToBuffer()

int fn_NetSim_Packet_AddPacketToBuffer ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData 
)

This function is to add packet to the buffer

Definition at line 104 of file Scheduling.c.

Here is the call graph for this function:

◆ fn_NetSim_Priority()

NetSim_PACKET * fn_NetSim_Priority ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData,
int  nType,
int  nFlag 
)

If the type is ADD, then all the packets will be added in the buffer based on packet priority If the type is GET, then the packets to be retrieved based on the priority

Definition at line 512 of file Scheduling.c.

Here is the caller graph for this function:

◆ fn_NetSim_Queuing()

enum enum_Buffer fn_NetSim_Queuing ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData 
)

This function is to return queuing status based on given algorithm

Definition at line 76 of file Scheduling.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fn_NetSim_RED()

enum enum_BUFFER fn_NetSim_RED ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData 
)

Queuing - RED

Definition at line 388 of file Scheduling.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fn_NetSim_RoundRobin()

NetSim_PACKET * fn_NetSim_RoundRobin ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData,
int  nType,
int  nFlag 
)

If the type is ADD, then all the packets will be added in the buffer based on packet priority in the corresponding list If the type is GET, then the packets to be retrieved in the order of one packet from each list(high priority list,Medium,Normal,Low)

Definition at line 620 of file Scheduling.c.

Here is the caller graph for this function:

◆ fn_NetSim_WFQ()

NetSim_PACKET * fn_NetSim_WFQ ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData,
int  nType,
int  nFlag 
)

If the type is ADD, then all the packets will be added in the buffer based on packet priority in the corresponding list If the type is GET, then the packets to be retrieved in the order of maximum weight priority list(High,Medium,Normal,Low)

Definition at line 701 of file Scheduling.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fn_NetSim_WRED()

enum enum_BUFFER fn_NetSim_WRED ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData 
)

Queuing - WRED

Definition at line 454 of file Scheduling.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_buffer_plot()

static void * init_buffer_plot ( NETSIM_ID  d,
NETSIM_ID  in 
)
static

Definition at line 31 of file Scheduling.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ red_algorithm()

static enum enum_BUFFER red_algorithm ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData 
)
static

Helper function for RED Queuing Technique

Definition at line 353 of file Scheduling.c.

Here is the caller graph for this function:

◆ reduce_current_size_buffer()

static void reduce_current_size_buffer ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData 
)
static

Function is used to reduce size of buffer(added while checkBuffer) in case of packet drop

Definition at line 336 of file Scheduling.c.

Here is the caller graph for this function:

◆ wred_algorithm()

static enum enum_BUFFER wred_algorithm ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruData,
double  max_th,
double  min_th,
double  max_p,
int *  count,
double *  random 
)
static

Helper function for WRED Queuing Technique

Definition at line 419 of file Scheduling.c.

Here is the caller graph for this function: