ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcbSocket.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
#include <netdb.h>
#include <poll.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ngc/core/ngcbSocket.h>

Macros

#define _GNU_SOURCE
 
#define _REENTRANT
 

Functions

void ngcbRegisterLock (void(*lock)(void), void(*unlock)(void))
 
void ngcbLock (void)
 
void ngcbUnlock (void)
 
void ngcbIpAddrCache (int flag)
 
int ngcbGetHostName (char *name, int size)
 
int ngcbGetHost (const char *name, char *ipAddr, char *hostName, char *erms)
 
int ngcbGetIpAddr (const char *name, char *ipAddr, char *erms)
 
int ngcbSocketPort (int fd)
 
void ngcbSocketHost (int fd, char *ipAddr)
 
int ngcbSocketWait (int fd, int timeout, char *erms)
 
int ngcbSocketWaitIntr (int fd1, int fd2, int timeout, char *erms)
 
int ngcbSocketPair (int fd[2], int bufferSize, char *erms)
 
int ngcbHostCompare (const char *host1, const char *host2)
 

Detailed Description

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

◆ _REENTRANT

#define _REENTRANT

Function Documentation

◆ ngcbGetHost()

int ngcbGetHost ( const char * name,
char * ipAddr,
char * hostName,
char * erms )

Convert name to ip-address if name is a hostname or converts name to hostname, if name is an ip-address.

◆ ngcbGetHostName()

int ngcbGetHostName ( char * name,
int size )

Returns the host name of the calling host. The maximum length of the name is given by size.

◆ ngcbGetIpAddr()

int ngcbGetIpAddr ( const char * name,
char * ipAddr,
char * erms )

Converts name to an ip-address.

◆ ngcbHostCompare()

int ngcbHostCompare ( const char * host1,
const char * host2 )

Check, whether two hosts are identical. The function returns zero if the comparison was successfull, otherwise a non-zero value is returned.

◆ ngcbIpAddrCache()

void ngcbIpAddrCache ( int flag)

Enable/disable IP-address cache.

◆ ngcbLock()

void ngcbLock ( void )

Lock - using the registered functions

◆ ngcbRegisterLock()

void ngcbRegisterLock ( void(* lock )(void),
void(* unlock )(void) )

Register locking functions

◆ ngcbSocketHost()

void ngcbSocketHost ( int fd,
char * ipAddr )

Returns the peer (remote) ipAddr (as string) associated with a socket.

◆ ngcbSocketPair()

int ngcbSocketPair ( int fd[2],
int bufferSize,
char * erms )

Create a pair of connected UNIX-domain sockets.

◆ ngcbSocketPort()

int ngcbSocketPort ( int fd)

Return the port number associated with a socket. If the socket is not valid zero is returned.

◆ ngcbSocketWait()

int ngcbSocketWait ( int fd,
int timeout,
char * erms )

Wait with timeout (in millisconds) for a socket to become readable. A negative value means no-timeout.

◆ ngcbSocketWaitIntr()

int ngcbSocketWaitIntr ( int fd1,
int fd2,
int timeout,
char * erms )

Waits with timeout (in millisconds) for socket fd1 or fd2 to become readable. A negative value means no-timeout. If a timeout occurs, the value -1 is returned. If socket fd2 becomes readable first, the value -2 is returned (interrupted).

◆ ngcbUnlock()

void ngcbUnlock ( void )

Unlock - using the registered functions