Relicense Sortix to the ISC license.
I hereby relicense all my work on Sortix under the ISC license as below.
All Sortix contributions by other people are already under this license,
are not substantial enough to be copyrightable, or have been removed.
All imported code from other projects is compatible with this license.
All GPL licensed code from other projects had previously been removed.
Copyright 2011-2016 Jonas 'Sortie' Termansen and contributors.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2016-03-02 17:38:16 -05:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013, 2014 Jonas 'Sortie' Termansen.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* netdb.h
|
|
|
|
* Definitions for network database operations.
|
|
|
|
*/
|
2013-03-19 17:40:37 -04:00
|
|
|
|
|
|
|
#ifndef _NETDB_H
|
|
|
|
#define _NETDB_H 1
|
|
|
|
|
2013-10-13 07:04:27 -04:00
|
|
|
#include <sys/cdefs.h>
|
2013-09-23 10:37:33 -04:00
|
|
|
|
|
|
|
#include <sys/__/types.h>
|
|
|
|
|
2013-03-19 17:40:37 -04:00
|
|
|
#include <inttypes.h>
|
|
|
|
|
2015-05-13 12:11:02 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2013-03-19 17:40:37 -04:00
|
|
|
|
2013-12-26 19:44:03 -05:00
|
|
|
#ifndef __in_port_t_defined
|
|
|
|
#define __in_port_t_defined
|
|
|
|
typedef uint16_t in_port_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __in_addr_t_defined
|
|
|
|
#define __in_addr_t_defined
|
|
|
|
typedef uint32_t in_addr_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __socklen_t_defined
|
|
|
|
#define __socklen_t_defined
|
|
|
|
typedef __socklen_t socklen_t;
|
|
|
|
#endif
|
2013-03-19 17:40:37 -04:00
|
|
|
|
2014-10-19 09:05:13 -04:00
|
|
|
/* struct hostent will not be implemented. */
|
2013-03-19 17:40:37 -04:00
|
|
|
|
|
|
|
struct netent
|
|
|
|
{
|
|
|
|
char* n_name;
|
|
|
|
char** n_aliases;
|
|
|
|
int n_addrtype;
|
|
|
|
uint32_t n_net;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct protoent
|
|
|
|
{
|
|
|
|
char* p_name;
|
|
|
|
char** p_aliases;
|
|
|
|
int p_proto;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct servent
|
|
|
|
{
|
|
|
|
char* s_name;
|
|
|
|
char** s_aliases;
|
|
|
|
char* s_proto;
|
|
|
|
int s_port;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct addrinfo
|
|
|
|
{
|
|
|
|
int ai_flags;
|
|
|
|
int ai_family;
|
|
|
|
int ai_socktype;
|
|
|
|
int ai_protocol;
|
|
|
|
socklen_t ai_addrlen;
|
|
|
|
struct sockaddr* ai_addr;
|
|
|
|
char* ai_canonname;
|
|
|
|
struct addrinfo* ai_next;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* TODO: Figure out how this relates to Sortix. */
|
|
|
|
#define IPPORT_RESERVED 1024
|
|
|
|
|
|
|
|
#define AI_PASSIVE (1<<0)
|
|
|
|
#define AI_CANONNAME (1<<1)
|
|
|
|
#define AI_NUMERICHOST (1<<2)
|
|
|
|
#define AI_NUMERICSERV (1<<3)
|
|
|
|
#define AI_V4MAPPED (1<<4)
|
|
|
|
#define AI_ALL (1<<5)
|
|
|
|
#define AI_ADDRCONFIG (1<<6)
|
|
|
|
|
|
|
|
#define NI_NOFQDN (1<<0)
|
|
|
|
#define NI_NUMERICHOST (1<<1)
|
|
|
|
#define NI_NAMEREQD (1<<2)
|
|
|
|
#define NI_NUMERICSERV (1<<3)
|
|
|
|
#define NI_NUMERICSCOPE (1<<4)
|
|
|
|
#define NI_DGRAM (1<<5)
|
|
|
|
|
|
|
|
#define EAI_AGAIN 1
|
|
|
|
#define EAI_BADFLAGS 2
|
|
|
|
#define EAI_FAIL 3
|
|
|
|
#define EAI_FAMILY 4
|
|
|
|
#define EAI_MEMORY 5
|
|
|
|
#define EAI_NONAME 6
|
|
|
|
#define EAI_SERVICE 7
|
|
|
|
#define EAI_SOCKTYPE 8
|
|
|
|
#define EAI_SYSTEM 9
|
|
|
|
#define EAI_OVERFLOW 10
|
|
|
|
|
|
|
|
/* These are not standardized, but are provided on other platforms and existing
|
|
|
|
sofware uses them, so let's just provide ourselves. */
|
|
|
|
#define NI_MAXHOST 1025
|
|
|
|
#define NI_MAXSERV 32
|
|
|
|
|
2014-10-19 09:05:13 -04:00
|
|
|
/* endhostent will not be implemented. */
|
2013-03-19 17:40:37 -04:00
|
|
|
void endnetent(void);
|
|
|
|
void endprotoent(void);
|
|
|
|
void endservent(void);
|
|
|
|
void freeaddrinfo(struct addrinfo*);
|
|
|
|
const char* gai_strerror(int);
|
2013-04-07 11:27:11 -04:00
|
|
|
int getaddrinfo(const char* __restrict, const char* __restrict,
|
|
|
|
const struct addrinfo* __restrict, struct addrinfo** __restrict);
|
2014-10-19 09:05:13 -04:00
|
|
|
/* gethostent will not be implemented. */
|
2013-04-07 11:27:11 -04:00
|
|
|
int getnameinfo(const struct sockaddr* __restrict, socklen_t, char* __restrict,
|
|
|
|
socklen_t, char* __restrict, socklen_t, int);
|
2013-03-19 17:40:37 -04:00
|
|
|
struct netent* getnetbyaddr(uint32_t, int);
|
|
|
|
struct netent* getnetbyname(const char*);
|
|
|
|
struct netent* getnetent(void);
|
|
|
|
struct protoent* getprotobyname(const char*);
|
|
|
|
struct protoent* getprotobynumber(int);
|
|
|
|
struct protoent* getprotoent(void);
|
|
|
|
struct servent* getservbyname(const char*, const char*);
|
|
|
|
struct servent* getservbyport(int, const char*);
|
|
|
|
struct servent* getservent(void);
|
2014-10-19 09:05:13 -04:00
|
|
|
/* sethostent will not be implemented. */
|
2013-03-19 17:40:37 -04:00
|
|
|
void setnetent(int);
|
|
|
|
void setprotoent(int);
|
|
|
|
void setservent(int);
|
|
|
|
|
2015-05-13 12:11:02 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
2013-03-19 17:40:37 -04:00
|
|
|
|
|
|
|
#endif
|