syslog-ng source
gsocket.c File Reference
#include "gsocket.h"
#include <errno.h>
#include <arpa/inet.h>
Include dependency graph for gsocket.c:

Functions

gchar * g_inet_ntoa (char *buf, size_t bufsize, struct in_addr a)
 
gint g_inet_aton (const char *buf, struct in_addr *a)
 
GIOStatus g_bind (int fd, GSockAddr *addr)
 
GIOStatus g_accept (int fd, int *newfd, GSockAddr **addr)
 
GIOStatus g_connect (int fd, GSockAddr *remote)
 
GSockAddrg_socket_get_peer_name (gint fd)
 
GSockAddrg_socket_get_local_name (gint fd)
 

Function Documentation

◆ g_accept()

GIOStatus g_accept ( int  fd,
int *  newfd,
GSockAddr **  addr 
)

g_accept: @fd: accept connection on this socket @newfd: fd of the accepted connection @addr: store the address of the client here

Accept a connection on the given fd, returning the newfd and the address of the client in a Zorp SockAddr structure.

Returns: glib style I/O error

◆ g_bind()

GIOStatus g_bind ( int  fd,
GSockAddr addr 
)

g_bind: @fd: fd to bind @addr: address to bind to

A thin interface around bind() using a GSockAddr structure for socket address. It enables the NET_BIND_SERVICE capability (should be in the permitted set.

◆ g_connect()

GIOStatus g_connect ( int  fd,
GSockAddr remote 
)

g_connect: @fd: socket to connect @remote: remote address

Connect a socket using Zorp style GSockAddr structure.

Returns: glib style I/O error

◆ g_inet_aton()

gint g_inet_aton ( const char *  buf,
struct in_addr *  a 
)

◆ g_inet_ntoa()

gchar* g_inet_ntoa ( char *  buf,
size_t  bufsize,
struct in_addr  a 
)

g_inet_ntoa: @buf: store result in this buffer @bufsize: the available space in buf : address to convert.

Thread friendly version of inet_ntoa(), converts an IP address to human readable form. Returns: the address of buf

◆ g_socket_get_local_name()

GSockAddr* g_socket_get_local_name ( gint  fd)

◆ g_socket_get_peer_name()

GSockAddr* g_socket_get_peer_name ( gint  fd)