XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Functions
xenet.cpp File Reference
#include <stdlib.h>
#include <sys/netdb.h>
#include <sys/socket.h>
#include <string.h>
#include <arpa/inet.h>
#include <sys/iocodes.h>
#include <stdio.h>
#include <sys/_keproc.h>
#include <sys/_kefile.h>
#include <sys/_ketime.h>
#include <stdint.h>
Include dependency graph for xenet.cpp:

Classes

struct  XeDnsAddr
 
struct  XeDnsResult
 
struct  XeDnsCacheEntry
 

Macros

#define DNS_QTYPE_A   1
 
#define DNS_QTYPE_AAAA   28
 
#define DNS_QCLASS_IN   1
 
#define DNS_TIMEOUT_MS   3000
 
#define DNS_POLL_MS   100
 
#define DNS_ROUTE_WAIT_MS   10000 /* wait for DHCP default route */
 
#define DNS_ROUTE_RETRY_MS   500
 
#define DNS_MAX_ADDRS   8
 
#define DNS_CACHE_SLOTS   32
 
#define DNS_NAME_MAX   256
 
#define DNS_TTL_CAP_S   60
 
#define DNS_NEG_TTL_S   5
 

Functions

int xe_hosts_lookup (const char *name, int *out_n, int *out_families, uint8_t out_addrs[][16], int maxn)
 
ssize_t recv (int sockfd, void *buf, size_t len, int flags)
 
ssize_t recvfrom (int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen)
 
ssize_t sendto (int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen)
 
uint32_t xe_dns_last_server (void)
 
struct hostent * gethostbyname (const char *name)
 
void freeaddrinfo (addrinfo *res)
 
const char * gai_strerror (int errcode)
 
int getaddrinfo (const char *node, const char *service, const addrinfo *hints, addrinfo **res)
 

Macro Definition Documentation

◆ DNS_CACHE_SLOTS

#define DNS_CACHE_SLOTS   32

◆ DNS_MAX_ADDRS

#define DNS_MAX_ADDRS   8

◆ DNS_NAME_MAX

#define DNS_NAME_MAX   256

◆ DNS_NEG_TTL_S

#define DNS_NEG_TTL_S   5

◆ DNS_POLL_MS

#define DNS_POLL_MS   100

◆ DNS_QCLASS_IN

#define DNS_QCLASS_IN   1

◆ DNS_QTYPE_A

#define DNS_QTYPE_A   1

◆ DNS_QTYPE_AAAA

#define DNS_QTYPE_AAAA   28

◆ DNS_ROUTE_RETRY_MS

#define DNS_ROUTE_RETRY_MS   500

◆ DNS_ROUTE_WAIT_MS

#define DNS_ROUTE_WAIT_MS   10000 /* wait for DHCP default route */

◆ DNS_TIMEOUT_MS

#define DNS_TIMEOUT_MS   3000

◆ DNS_TTL_CAP_S

#define DNS_TTL_CAP_S   60

Function Documentation

◆ freeaddrinfo()

void freeaddrinfo ( addrinfo *  res)

◆ gai_strerror()

const char * gai_strerror ( int  errcode)

◆ getaddrinfo()

int getaddrinfo ( const char *  node,
const char *  service,
const addrinfo *  hints,
addrinfo **  res 
)

◆ gethostbyname()

struct hostent * gethostbyname ( const char *  name)

◆ recv()

ssize_t recv ( int  sockfd,
void *  buf,
size_t  len,
int  flags 
)

◆ recvfrom()

ssize_t recvfrom ( int  sockfd,
void *  buf,
size_t  len,
int  flags,
struct sockaddr *  src_addr,
socklen_t *  addrlen 
)

◆ sendto()

ssize_t sendto ( int  sockfd,
const void *  buf,
size_t  len,
int  flags,
const struct sockaddr *  dest_addr,
socklen_t  addrlen 
)

◆ xe_dns_last_server()

uint32_t xe_dns_last_server ( void  )

◆ xe_hosts_lookup()

int xe_hosts_lookup ( const char *  name,
int *  out_n,
int *  out_families,
uint8_t  out_addrs[][16],
int  maxn 
)
extern

BSD 2-Clause License

Copyright (c) 2022-2024, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

xe_hosts_lookup – resolve from the static XR/localhost table.

Returns
1 hit (fills out_*), 0 not special (continue to DNS), -1 .localhost with no entry (fail locally, no upstream)