Shadow Network Framework  0.0.1-alpha
C Server Library for Shadow Network Framework
Loading...
Searching...
No Matches
epoll.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////
2///
3/// \file epoll.h
4/// This file is used to define functions related to epoll
5/// that would be used mainly in network.c
6///
7/// \warning Do not use any functions inside this file outside of
8/// **network.c**, unless you know what you're doing.
9///
10///////////////////////////////////////////////////////////////////
11
12#ifndef epoll_h
13#define epoll_h
14
15#include <SNF/SNF.h>
16#include <SNF/network.h>
17
18/// @brief Defines the epoll's limit
19/// @note Temporarly is a fixed value of 4096 for testing purposes
20#define SNF_MAXEVENTS 4096
21
22/// @brief Used to save the waiting ***Epoll Events***
23extern struct epoll_event SNF_EPOLL_EVENTS[SNF_MAXEVENTS];
24/// @brief Describes the amount of file descriptors to be handled
25extern int SNF_NFDS;
26/// @brief Defines Epoll's file descriptor.
27extern int SNF_EPOLLFD;
28
29/// @brief Initializes the Epoll
30extern void snf_epoll_init();
31/// @brief Add's a file descriptor to be handled by epoll
32/// @param FD The File descriptor to be added
33/// @return The result :
34/// * **0** Success
35/// * **1** Fail
36extern int snf_epoll_add(int FD);
37/// @brief removes a file descriptor from being handled by epoll
38/// @param fd The File descriptor to be removed
39extern void snf_epoll_del(int fd);
40/// @brief Fetches the awaiting **Epoll Events**
41/// @return The result of the wait
42/// @note - This function will block depending on epoll_wait (set with a timeout of 10 ms)
43/// @note - the awaiting **Epoll Events** will be put in \ref SNF_EPOLL_EVENTS
44extern int snf_epoll_getList();
45
46#endif
This file includes necessary Checks and includes the the nesessary libraries of the library.
int snf_epoll_add(int FD)
Add's a file descriptor to be handled by epoll.
#define SNF_MAXEVENTS
Defines the epoll's limit.
Definition epoll.h:20
int SNF_NFDS
Describes the amount of file descriptors to be handled.
void snf_epoll_init()
Initializes the Epoll.
struct epoll_event SNF_EPOLL_EVENTS[SNF_MAXEVENTS]
Used to save the waiting Epoll Events
int SNF_EPOLLFD
Defines Epoll's file descriptor.
int snf_epoll_getList()
Fetches the awaiting Epoll Events
void snf_epoll_del(int fd)
removes a file descriptor from being handled by epoll
This file Defines everything related to networking.