39 lines
818 B
C
39 lines
818 B
C
#ifndef NX_HOSTS_H
|
|
#define NX_HOSTS_H
|
|
|
|
#include "nx_types.h"
|
|
#include "nx_sockaddr.h"
|
|
|
|
#if defined(__cplusplus)
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define NX_HOSTS_DEFAULT_DIR "/var/lib/libnx"
|
|
#define NX_HOSTS_DEFAULT_FILE NX_HOSTS_DEFAULT_DIR "/hosts.txt"
|
|
#define NX_HOSTS_DEFAULT_ALT NX_HOSTS_DEFAULT_DIR "/hosts.list"
|
|
|
|
typedef struct nx_hosts nx_hosts;
|
|
|
|
int nx_hosts_load(nx_hosts **out, const char *path);
|
|
|
|
void nx_hosts_free(nx_hosts *h);
|
|
|
|
size_t nx_hosts_count(const nx_hosts *h);
|
|
|
|
int nx_hosts_lookup(const nx_hosts *h, const char *name, int family, int port,
|
|
struct sockaddr_storage *out, socklen_t *outlen, int max);
|
|
|
|
nx_hosts *nx_hosts_global(void);
|
|
|
|
void nx_hosts_set_global(nx_hosts *h);
|
|
|
|
void nx_hosts_clear_global(void);
|
|
|
|
int nx_hosts_load_default(void);
|
|
|
|
#if defined(__cplusplus)
|
|
}
|
|
#endif
|
|
|
|
#endif
|