Shadow Network Framework  0.0.1-alpha
C Server Library for Shadow Network Framework
Loading...
Searching...
No Matches
epoll.h File Reference

This file is used to define functions related to epoll that would be used mainly in network.c. More...

Go to the source code of this file.

Macros

#define SNF_MAXEVENTS   4096
 Defines the epoll's limit.
 

Functions

void snf_epoll_init ()
 Initializes the Epoll.
 
int snf_epoll_add (int FD)
 Add's a file descriptor to be handled by epoll.
 
void snf_epoll_del (int fd)
 removes a file descriptor from being handled by epoll
 
int snf_epoll_getList ()
 Fetches the awaiting Epoll Events
 

Variables

struct epoll_event SNF_EPOLL_EVENTS [SNF_MAXEVENTS]
 Used to save the waiting Epoll Events
 
int SNF_NFDS
 Describes the amount of file descriptors to be handled.
 
int SNF_EPOLLFD
 Defines Epoll's file descriptor.
 

Detailed Description

This file is used to define functions related to epoll that would be used mainly in network.c.

Warning
Do not use any functions inside this file outside of network.c, unless you know what you're doing.

Macro Definition Documentation

◆ SNF_MAXEVENTS

#define SNF_MAXEVENTS   4096

Defines the epoll's limit.

Note
Temporarly is a fixed value of 4096 for testing purposes

Function Documentation

◆ snf_epoll_init()

void snf_epoll_init ( )
extern

Initializes the Epoll.

◆ snf_epoll_add()

int snf_epoll_add ( int FD)
extern

Add's a file descriptor to be handled by epoll.

Parameters
FDThe File descriptor to be added
Returns
The result :
  • 0 Success
  • 1 Fail

◆ snf_epoll_del()

void snf_epoll_del ( int fd)
extern

removes a file descriptor from being handled by epoll

Parameters
fdThe File descriptor to be removed

◆ snf_epoll_getList()

int snf_epoll_getList ( )
extern

Fetches the awaiting Epoll Events

Returns
The result of the wait
Note
- This function will block depending on epoll_wait (set with a timeout of 10 ms)
- the awaiting Epoll Events will be put in SNF_EPOLL_EVENTS

Variable Documentation

◆ SNF_EPOLL_EVENTS

struct epoll_event SNF_EPOLL_EVENTS[SNF_MAXEVENTS]
extern

Used to save the waiting Epoll Events

◆ SNF_NFDS

int SNF_NFDS
extern

Describes the amount of file descriptors to be handled.

◆ SNF_EPOLLFD

int SNF_EPOLLFD
extern

Defines Epoll's file descriptor.