NetSim Source Code Help
Loading...
Searching...
No Matches
Linux.h File Reference
#include <string.h>
#include <errno.h>
#include <math.h>
#include <ctype.h>
#include <dlfcn.h>
#include <pthread.h>
#include <time.h>
#include <malloc.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
Include dependency graph for Linux.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _LARGE_INTEGER
 
struct  _SYSTEMTIME
 

Macros

#define INT8   int8_t
 
#define UINT8   uint8_t
 
#define INT16   int16_t
 
#define UINT16   uint16_t
 
#define INT32   int32_t
 
#define UINT32   uint32_t
 
#define INT64   int64_t
 
#define UINT64   uint64_t
 
#define UINT   unsigned int
 
#define _declspec(dllexport)   extern
 This function is used to trigger the update. More...
 
#define _declspec(dllimport)   extern
 
#define GetLastError()   errno
 
#define _getch()   ;
 
#define getch()   ;
 
#define PVOID   void*
 
#define HINSTANCE   void*
 
#define LoadLibraryA(x)   dlopen(x,RTLD_NOW)
 
#define LoadLibrary(x)   dlopen(x,RTLD_NOW)
 
#define GetProcAddress(x, y)   dlsym(x,y)
 
#define FreeLibrary   dlclose
 
#define MessageBoxA(a, b, c, d)   printf("%s\t%s\n",b,c);
 
#define MessageBox(a, b, c, d)   printf("%s\t%s\n",b,c);
 
#define fnDlError(x)   {printf("Error: %s\n",dlerror());}
 
#define fnSystemError(x, ...)   {printf("Error No:%d in %s line no %d: %s\n",errno,__FILE__,__LINE__,x);}
 
#define fnNetSimError(x, ...)   {printf("In %s line no %d: %s",__FILE__,__LINE__,x);}
 
#define GetCurrentThreadId()   pthread_self()
 
#define WriteFile(file, str, size, a, b)   write(file,str,size)
 
#define BOOLEAN   BOOL
 
#define HANDLE   void *
 
#define HMODULE   void*
 
#define pthread_mutex_destroy(a)   ReleaseMutex(a)
 
#define FALSE   0
 
#define TRUE   1
 
#define WORD   unsigned short
 
#define DWORD   unsigned int
 
#define WINAPI
 
#define LPVOID   void *
 
#define INFINITE   INFINITY
 
#define WaitForSingleObject(mutexObject, b)   pthread_mutex_lock( mutexObject )
 
#define ReleaseMutex(mutexObject)   pthread_mutex_unlock(mutexObject)
 
#define _popen(a, b)   popen(a,b)
 
#define _pclose(a)   pclose(a)
 
#define CRITICAL_SECTION   pthread_mutex_t;
 
#define FARPROC   void *
 
#define EnterCriticalSection(a)   pthread_mutex_lock (a);
 
#define LeaveCriticalSection(a)   pthread_mutex_unlock (a);
 
#define DeleteCriticalSection(a)   pthread_mutex_destroy (a);
 
#define CreateMutexA   CreateMutex
 
#define CloseHandle(mutex)   pthread_mutex_destroy(mutex);
 
#define Sleep(x)   usleep(1000*x)
 
#define _fcloseall()   fcloseall()
 
#define min(a, b)   !(b<a)?a:b
 
#define max(a, b)   !(b>a)?a:b
 
#define __debugbreak()
 
#define __in
 
#define __out
 
#define _strrev   strrev
 
#define _strdup(x)   x==NULL?NULL:strdup(x)
 
#define _stricmp   strcasecmp
 
#define stricmp   strcasecmp
 
#define SetLastError(x)   errno=x
 

Typedefs

typedef struct _LARGE_INTEGER LARGE_INTEGER
 
typedef struct _SYSTEMTIME SYSTEMTIME
 
typedef unsigned char u_char
 
typedef unsigned short u_short
 
typedef unsigned int u_int
 
typedef unsigned long u_long
 

Enumerations

enum  BOOL { FALSE =0 , TRUE =1 }
 

Functions

void * CreateMutex (void *att, int a, char *name)
 
void WaitForMultipleObjects (DWORD nCount, const pthread_mutex_t *lpHandles, int bWaitAll, DWORD dwMilliseconds)
 
char * _strrev (char *str)
 
char * _strupr (char *s)
 
void GetSystemTime (struct _SYSTEMTIME *lp)
 
DWORD GetTickCount ()
 
int _msize (void *p)
 
void _putenv (char *s)
 

Variables

static const char pathSeperator [5] = "/"
 

Macro Definition Documentation

◆ __debugbreak

#define __debugbreak ( )

Definition at line 108 of file Linux.h.

◆ __in

#define __in

Definition at line 113 of file Linux.h.

◆ __out

#define __out

Definition at line 114 of file Linux.h.

◆ _declspec [1/2]

_declspec (   dllexport)    extern

This function is used to trigger the update.

The data received in the echo message must be returned in the echo reply message.

This function is to process the echo request.

Function to copy the RIP packet from source to destination.

Function to free the allocated memory for the RIP packet.

Return the subevent name with respect to the subevent number for writting event trace.

Function to free the RIP protocol variable and Unload the primitives.

Function for configuring RIP parameters

Function for Intializing RIP protocol

Function to run RIP protocol

Operations Manager uses a high-performance, asynchronous ICMP poller.
The ICMP poller performs at a consistent rate that is independent of poll response times.
Operations Manager achieves this using two asynchronous threads:
one that sends polls and one that receives polls. Because the send and receive threads
operate asynchronously, slow response times or excessive timeouts do not affect the polling rate.
static struct stru_802_11_Phy_Parameters_HT a

This function is used to generate echo request

This function is to check the gateway state

The ICMP router discovery messages are called "Router Advertisements" and "Router Solicitations". Each router periodically multicasts a Router Advertisement from each of its multicast interfaces, announcing the IP address(es) of that interface. Hosts discover the addresses of their neighboring routers simply by listening for advertisements. When a host attached to a multicast link starts up, it may multicast a Router Solicitation to ask for immediate advertisements, rather than waiting for the next periodic ones to arrive; if (and only if) no advertisements are forthcoming, the host may retransmit the solicitation a small number of times, but then must desist from sending any more solicitations. Any routers that subsequently start up, or that were not discovered because of packet loss or temporary link partitioning, are eventually discovered by reception of their periodic (unsolicited) advertisements. (Links that suffer high packet loss rates or frequent partitioning are accommodated by increasing the rate of advertisements, rather than increasing the number of solicitations that hosts are permitted to send.)

The router discovery messages do not constitute a routing protocol:
they enable hosts to discover the existence of neighboring routers,
but not which router is best to reach a particular destination. If a
host chooses a poor first-hop router for a particular destination, it
should receive an ICMP Redirect from that router, identifying a
better one.
A Router Advertisement includes a "preference level" for each
advertised router address. When a host must choose a default router
address (i.e., when, for a particular destination, the host has not
been redirected or configured to use a specific router address), it
is expected to choose from those router addresses that have the
highest preference level.
A Router Advertisement also includes a "lifetime" field, specifying
the maximum length of time that the advertised addresses are to be
considered as valid router addresses by hosts, in the absence of
further advertisements. This is used to ensure that hosts eventually
forget about routers that fail, become unreachable, or stop acting as
routers.
The default advertising rate is once every 7 to 10 minutes, and the
default lifetime is 30 minutes.
If, according to the information in the gateway's routing tables,
the network specified in the internet destination field of a
datagram is unreachable, e.g., the distance to the network is
infinity, the gateway sends a destination unreachable message to
the internet source host of the datagram. In addition, in some
networks, the gateway may be able to determine if the internet
destination host is unreachable. Gateways in these networks may
send destination unreachable messages to the source host when the
destination host is unreachable.
If, in the destination host, the IP module cannot deliver the
datagram because the indicated protocol module or process port is
not active, the destination host may send a destination
unreachable message to the source host.
Another case is when a datagram must be fragmented to be forwarded
by a gateway yet the Don't Fragment flag is on. In this case the
gateway must discard the datagram and return a destination
unreachable message.

Definition at line 41 of file Linux.h.

◆ _declspec [2/2]

#define _declspec (   dllimport)    extern

Definition at line 41 of file Linux.h.

◆ _fcloseall

#define _fcloseall ( )    fcloseall()

Definition at line 105 of file Linux.h.

◆ _getch

#define _getch ( )    ;

Definition at line 44 of file Linux.h.

◆ _pclose

#define _pclose (   a)    pclose(a)

Definition at line 96 of file Linux.h.

◆ _popen

#define _popen (   a,
 
)    popen(a,b)

Definition at line 95 of file Linux.h.

◆ _strdup

#define _strdup (   x)    x==NULL?NULL:strdup(x)

Definition at line 126 of file Linux.h.

◆ _stricmp

#define _stricmp   strcasecmp

Definition at line 127 of file Linux.h.

◆ _strrev

#define _strrev   strrev

Definition at line 122 of file Linux.h.

◆ BOOLEAN

#define BOOLEAN   BOOL

Definition at line 59 of file Linux.h.

◆ CloseHandle

#define CloseHandle (   mutex)    pthread_mutex_destroy(mutex);

Definition at line 103 of file Linux.h.

◆ CreateMutexA

#define CreateMutexA   CreateMutex

Definition at line 102 of file Linux.h.

◆ CRITICAL_SECTION

#define CRITICAL_SECTION   pthread_mutex_t;

Definition at line 97 of file Linux.h.

◆ DeleteCriticalSection

#define DeleteCriticalSection (   a)    pthread_mutex_destroy (a);

Definition at line 101 of file Linux.h.

◆ DWORD

#define DWORD   unsigned int

Definition at line 79 of file Linux.h.

◆ EnterCriticalSection

#define EnterCriticalSection (   a)    pthread_mutex_lock (a);

Definition at line 99 of file Linux.h.

◆ FALSE

#define FALSE   0

Definition at line 76 of file Linux.h.

◆ FARPROC

#define FARPROC   void *

Definition at line 98 of file Linux.h.

◆ fnDlError

#define fnDlError (   x)    {printf("Error: %s\n",dlerror());}

Definition at line 54 of file Linux.h.

◆ fnNetSimError

#define fnNetSimError (   x,
  ... 
)    {printf("In %s line no %d: %s",__FILE__,__LINE__,x);}

Definition at line 56 of file Linux.h.

◆ fnSystemError

#define fnSystemError (   x,
  ... 
)    {printf("Error No:%d in %s line no %d: %s\n",errno,__FILE__,__LINE__,x);}

Definition at line 55 of file Linux.h.

◆ FreeLibrary

#define FreeLibrary   dlclose

Definition at line 51 of file Linux.h.

◆ getch

#define getch ( )    ;

Definition at line 45 of file Linux.h.

◆ GetCurrentThreadId

#define GetCurrentThreadId ( )    pthread_self()

Definition at line 57 of file Linux.h.

◆ GetLastError

#define GetLastError ( )    errno

Definition at line 42 of file Linux.h.

◆ GetProcAddress

#define GetProcAddress (   x,
 
)    dlsym(x,y)

Definition at line 50 of file Linux.h.

◆ HANDLE

#define HANDLE   void *

Definition at line 73 of file Linux.h.

◆ HINSTANCE

#define HINSTANCE   void*

Definition at line 47 of file Linux.h.

◆ HMODULE

#define HMODULE   void*

Definition at line 74 of file Linux.h.

◆ INFINITE

#define INFINITE   INFINITY

Definition at line 82 of file Linux.h.

◆ INT16

#define INT16   int16_t

Definition at line 32 of file Linux.h.

◆ INT32

#define INT32   int32_t

Definition at line 34 of file Linux.h.

◆ INT64

#define INT64   int64_t

Definition at line 36 of file Linux.h.

◆ INT8

#define INT8   int8_t

Definition at line 30 of file Linux.h.

◆ LeaveCriticalSection

#define LeaveCriticalSection (   a)    pthread_mutex_unlock (a);

Definition at line 100 of file Linux.h.

◆ LoadLibrary

#define LoadLibrary (   x)    dlopen(x,RTLD_NOW)

Definition at line 49 of file Linux.h.

◆ LoadLibraryA

#define LoadLibraryA (   x)    dlopen(x,RTLD_NOW)

Definition at line 48 of file Linux.h.

◆ LPVOID

#define LPVOID   void *

Definition at line 81 of file Linux.h.

◆ max

#define max (   a,
 
)    !(b>a)?a:b

Definition at line 107 of file Linux.h.

◆ MessageBox

#define MessageBox (   a,
  b,
  c,
 
)    printf("%s\t%s\n",b,c);

Definition at line 53 of file Linux.h.

◆ MessageBoxA

#define MessageBoxA (   a,
  b,
  c,
 
)    printf("%s\t%s\n",b,c);

Definition at line 52 of file Linux.h.

◆ min

#define min (   a,
 
)    !(b<a)?a:b

Definition at line 106 of file Linux.h.

◆ pthread_mutex_destroy

#define pthread_mutex_destroy (   a)    ReleaseMutex(a)

Definition at line 75 of file Linux.h.

◆ PVOID

#define PVOID   void*

Definition at line 46 of file Linux.h.

◆ ReleaseMutex

#define ReleaseMutex (   mutexObject)    pthread_mutex_unlock(mutexObject)

Definition at line 84 of file Linux.h.

◆ SetLastError

#define SetLastError (   x)    errno=x

Definition at line 146 of file Linux.h.

◆ Sleep

#define Sleep (   x)    usleep(1000*x)

Definition at line 104 of file Linux.h.

◆ stricmp

#define stricmp   strcasecmp

Definition at line 128 of file Linux.h.

◆ TRUE

#define TRUE   1

Definition at line 77 of file Linux.h.

◆ UINT

#define UINT   unsigned int

Definition at line 38 of file Linux.h.

◆ UINT16

#define UINT16   uint16_t

Definition at line 33 of file Linux.h.

◆ UINT32

#define UINT32   uint32_t

Definition at line 35 of file Linux.h.

◆ UINT64

#define UINT64   uint64_t

Definition at line 37 of file Linux.h.

◆ UINT8

#define UINT8   uint8_t

Definition at line 31 of file Linux.h.

◆ WaitForSingleObject

#define WaitForSingleObject (   mutexObject,
 
)    pthread_mutex_lock( mutexObject )

Definition at line 83 of file Linux.h.

◆ WINAPI

#define WINAPI

Definition at line 80 of file Linux.h.

◆ WORD

#define WORD   unsigned short

Definition at line 78 of file Linux.h.

◆ WriteFile

#define WriteFile (   file,
  str,
  size,
  a,
 
)    write(file,str,size)

Definition at line 58 of file Linux.h.

Typedef Documentation

◆ LARGE_INTEGER

typedef struct _LARGE_INTEGER LARGE_INTEGER

◆ SYSTEMTIME

typedef struct _SYSTEMTIME SYSTEMTIME

◆ u_char

typedef unsigned char u_char

Definition at line 109 of file Linux.h.

◆ u_int

typedef unsigned int u_int

Definition at line 111 of file Linux.h.

◆ u_long

typedef unsigned long u_long

Definition at line 112 of file Linux.h.

◆ u_short

typedef unsigned short u_short

Definition at line 110 of file Linux.h.

Enumeration Type Documentation

◆ BOOL

enum BOOL
Enumerator
FALSE 
TRUE 

Definition at line 61 of file Linux.h.

Function Documentation

◆ _msize()

int _msize ( void *  p)

◆ _putenv()

void _putenv ( char *  s)
Here is the caller graph for this function:

◆ _strrev()

char * _strrev ( char *  str)

◆ _strupr()

char * _strupr ( char *  s)
Here is the caller graph for this function:

◆ CreateMutex()

void * CreateMutex ( void *  att,
int  a,
char *  name 
)

◆ GetSystemTime()

void GetSystemTime ( struct _SYSTEMTIME lp)

◆ GetTickCount()

DWORD GetTickCount ( )

◆ WaitForMultipleObjects()

void WaitForMultipleObjects ( DWORD  nCount,
const pthread_mutex_t *  lpHandles,
int  bWaitAll,
DWORD  dwMilliseconds 
)

Variable Documentation

◆ pathSeperator

const char pathSeperator[5] = "/"
static

Definition at line 71 of file Linux.h.