leafnode  1.12.0
About: Leafnode is a store & forward NNTP proxy for small (dialup) sites.
  Fossies Dox: leafnode-1.12.0.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

masock_sa2name.c File Reference
#include "masock.h"
#include "critmem.h"
#include "config.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <string.h>
#include <errno.h>
Include dependency graph for masock_sa2name.c:

Go to the source code of this file.

Macros

#define _GNU_SOURCE
 

Functions

char * masock_sa2name (const struct sockaddr *sa, int *h_e)
 

Detailed Description

(C) Copyright 2001 - 2021 by Matthias Andree

Author
Matthias Andree \year 2001,2021

Definition in file masock_sa2name.c.

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE
Value:
/* to expose nonstandard members in in.h structures to
* fix compilation in strict conformance mode on Linux
*/

Definition at line 8 of file masock_sa2name.c.

Function Documentation

◆ masock_sa2name()

char * masock_sa2name ( const struct sockaddr *  sa,
int *  h_e 
)

Look up the host name belonging to the socket address. If compiled with IPv6 support, use IPv6 lookup unless the address is actually an IPv6-mapped IPv4 address.

Returns
strdup'ed string containing the host name or NULL in case of trouble.
Bug:
Linux [e]glibc has broken IN6_IS_ADDR_* macros that do not cast to const and that do not work in strict conformance mode because they access nonstandard members.
Parameters
sasocket address to convert
h_evariable to place h_errno into

Definition at line 43 of file masock_sa2name.c.

References critstrdup().

Referenced by main().