Skip to content

file /Users/ios_developer/workspace/coldwave-os/build/_deps/flake-src/posix/netdb.h

Types

Name
structhostent
structaddrinfo

Functions Overview

Name
struct hostent *gethostbyname(const char * name)
intgethostbyname_r(const char * name, struct hostent * ret, char * buf, size_t buflen, struct hostent ** result, int * h_errnop)
voidfreeaddrinfo(struct addrinfo * ai)
intgetaddrinfo(const char * nodename, const char * servname, const struct addrinfo * hints, struct addrinfo ** res)

Attributes

Name
inth_errno

Defines

Name
EAI_NONAME
EAI_SERVICE
EAI_FAIL
EAI_MEMORY
EAI_FAMILY
HOST_NOT_FOUND
NO_DATA
NO_RECOVERY
TRY_AGAIN
AI_PASSIVE
AI_CANONNAME
AI_NUMERICHOST
AI_NUMERICSERV
AI_V4MAPPED
AI_ALL
AI_ADDRCONFIG
h_addr

Function Details

function gethostbyname

cpp
struct hostent * gethostbyname(
    const char * name
)

function gethostbyname_r

cpp
int gethostbyname_r(
    const char * name,
    struct hostent * ret,
    char * buf,
    size_t buflen,
    struct hostent ** result,
    int * h_errnop
)

function freeaddrinfo

cpp
void freeaddrinfo(
    struct addrinfo * ai
)

function getaddrinfo

cpp
int getaddrinfo(
    const char * nodename,
    const char * servname,
    const struct addrinfo * hints,
    struct addrinfo ** res
)

Attributes Documentation

variable h_errno

cpp
int h_errno

Macros Documentation

define EAI_NONAME

cpp
#define EAI_NONAME 200

define EAI_SERVICE

cpp
#define EAI_SERVICE 201

define EAI_FAIL

cpp
#define EAI_FAIL 202

define EAI_MEMORY

cpp
#define EAI_MEMORY 203

define EAI_FAMILY

cpp
#define EAI_FAMILY 204

define HOST_NOT_FOUND

cpp
#define HOST_NOT_FOUND 210

define NO_DATA

cpp
#define NO_DATA 211

define NO_RECOVERY

cpp
#define NO_RECOVERY 212

define TRY_AGAIN

cpp
#define TRY_AGAIN 213

define AI_PASSIVE

cpp
#define AI_PASSIVE 0x01

define AI_CANONNAME

cpp
#define AI_CANONNAME 0x02

define AI_NUMERICHOST

cpp
#define AI_NUMERICHOST 0x04

define AI_NUMERICSERV

cpp
#define AI_NUMERICSERV 0x08

define AI_V4MAPPED

cpp
#define AI_V4MAPPED 0x10

define AI_ALL

cpp
#define AI_ALL 0x20

define AI_ADDRCONFIG

cpp
#define AI_ADDRCONFIG 0x40

define h_addr

cpp
#define h_addr h_addr_list[0] /* for backward compatibility */

Source code

cpp
//
// Created by Sebastian Floss on 06.07.19.
// Copyright (c) 2019 ImagineOn GmbH. All rights reserved.
//

#ifndef _COLDWAVEOS_NETDB_H
#define _COLDWAVEOS_NETDB_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>
#include <sys/socket.h>

#define EAI_NONAME      200
#define EAI_SERVICE     201
#define EAI_FAIL        202
#define EAI_MEMORY      203
#define EAI_FAMILY      204

#define HOST_NOT_FOUND  210
#define NO_DATA         211
#define NO_RECOVERY     212
#define TRY_AGAIN       213

/* input flags for struct addrinfo */
#define AI_PASSIVE      0x01
#define AI_CANONNAME    0x02
#define AI_NUMERICHOST  0x04
#define AI_NUMERICSERV  0x08
#define AI_V4MAPPED     0x10
#define AI_ALL          0x20
#define AI_ADDRCONFIG   0x40

struct hostent {
    char *h_name;      /* Official name of the host. */
    char **h_aliases;   /* A pointer to an array of pointers to alternative host names,
                           terminated by a null pointer. */
    int h_addrtype;  /* Address type. */
    int h_length;    /* The length, in bytes, of the address. */
    char **h_addr_list; /* A pointer to an array of pointers to network addresses (in
                           network byte order) for the host, terminated by a null pointer. */
#define h_addr h_addr_list[0] /* for backward compatibility */
};

struct addrinfo {
    int ai_flags;      /* Input flags. */
    int ai_family;     /* Address family of socket. */
    int ai_socktype;   /* Socket type. */
    int ai_protocol;   /* Protocol of socket. */
    socklen_t ai_addrlen;    /* Length of socket address. */
    struct sockaddr *ai_addr;       /* Socket address of socket. */
    char *ai_canonname;  /* Canonical name of service location. */
    struct addrinfo *ai_next;       /* Pointer to next in list. */
};
/* application accessible error code set by the DNS API functions */
extern int h_errno;

struct hostent *
gethostbyname (const char *name);

int
gethostbyname_r (const char *name, struct hostent *ret, char *buf,
                 size_t buflen, struct hostent **result, int *h_errnop);

void
freeaddrinfo (struct addrinfo *ai);

int
getaddrinfo (const char *nodename,
             const char *servname,
             const struct addrinfo *hints,
             struct addrinfo **res);

#ifdef __cplusplus
}
#endif

#endif //_COLDWAVEOS_NETDB_H