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.


#define _GNU_SOURCE


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

Detailed Description

(C) Copyright 2001 - 2021 by Matthias Andree

Matthias Andree \year 2001,2021

Definition in file masock_sa2name.c.

Macro Definition Documentation


#define _GNU_SOURCE
/* 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.

strdup'ed string containing the host name or NULL in case of trouble.
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.
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().