Ripples 1.0
High Performant Software Architecture For Transaction Processing
Loading...
Searching...
No Matches
rip_ns_utils.h File Reference
#include <endian.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for rip_ns_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rip_ns_header_s
 

Macros

#define RIP_NS_PACKETSZ   512
 
#define RIP_NS_UDP_MAXMSG   4096
 
#define RIP_NS_MAXMSG   65535
 
#define RIP_NS_MAXCDNAME   255
 
#define RIP_NS_MAXLABEL   63
 
#define RIP_NS_QFIXEDSZ   4
 
#define RIP_NS_RRFIXEDSZ   10
 
#define RIP_NS_INT32SZ   4
 
#define RIP_NS_INT16SZ   2
 
#define RIP_NS_INT8SZ   1
 
#define RIP_NS_INADDRSZ   4
 
#define RIP_NS_IN6ADDRSZ   16
 
#define RIP_NS_CMPRSFLGS   0xc0
 
#define RIP_NS_RESP_MAX_ANSW   128
 
#define RIP_NS_RESP_MAX_NS   16
 
#define RIP_NS_RESP_MAX_ADDL   128
 
#define RIP_NS_CDNAME_COMP_BUF_LEN   256
 
#define RIP_NS_QUERY_SET_END_CODE_AND_RETURN(q, c)
 
#define RIP_NS_GET16(s, cp)
 
#define RIP_NS_PUT16(s, cp)
 
#define RIP_NS_GET32(l, cp)
 
#define RIP_NS_PUT32(l, cp)
 

Typedefs

typedef enum rip_ns_flag_e rip_ns_flag_t
 
typedef enum rip_ns_opcode_e rip_ns_opcode_t
 
typedef enum rip_ns_rcode_e rip_ns_rcode_t
 
typedef enum rip_ns_type_e rip_ns_type_t
 
typedef enum rip_ns_class_e rip_ns_class_t
 
typedef enum rip_ns_ext_opt_code_e rip_ns_ext_opt_code_t
 
typedef struct rip_ns_header_s rip_ns_header_t
 

Enumerations

enum  rip_ns_flag_e {
  rip_ns_f_qr , rip_ns_f_opcode , rip_ns_f_aa , rip_ns_f_tc ,
  rip_ns_f_rd , rip_ns_f_ra , rip_ns_f_z , rip_ns_f_ad ,
  rip_ns_f_cd , rip_ns_f_rcode , rip_ns_f_max
}
 
enum  rip_ns_opcode_e {
  rip_ns_o_query = 0 , rip_ns_o_iquery = 1 , rip_ns_o_status = 2 , rip_ns_o_notify = 4 ,
  rip_ns_o_update = 5 , rip_ns_o_max = 6
}
 
enum  rip_ns_rcode_e {
  rip_ns_r_noerror = 0 , rip_ns_r_formerr = 1 , rip_ns_r_servfail = 2 , rip_ns_r_nxdomain = 3 ,
  rip_ns_r_notimpl = 4 , rip_ns_r_refused = 5 , rip_ns_r_yxdomain = 6 , rip_ns_r_yxrrset = 7 ,
  rip_ns_r_nxrrset = 8 , rip_ns_r_notauth = 9 , rip_ns_r_notzone = 10 , rip_ns_r_max = 11 ,
  rip_ns_r_badvers = 16 , rip_ns_r_badsig = 16 , rip_ns_r_badkey = 17 , rip_ns_r_badtime = 18 ,
  rip_ns_r_rip_unknown = -1 , rip_ns_r_rip_shortheader = -2 , rip_ns_r_rip_toolarge = -3 , rip_ns_r_rip_query_tc = -4 ,
  rip_ns_r_rip_pack_rr_err = -5 , rip_ns_r_rip_tcp_write_err = -6 , rip_ns_r_rip_tcp_write_close = -7
}
 
enum  rip_ns_type_e {
  rip_ns_t_invalid = 0 , rip_ns_t_a = 1 , rip_ns_t_ns = 2 , rip_ns_t_md = 3 ,
  rip_ns_t_mf = 4 , rip_ns_t_cname = 5 , rip_ns_t_soa = 6 , rip_ns_t_mb = 7 ,
  rip_ns_t_mg = 8 , rip_ns_t_mr = 9 , rip_ns_t_null = 10 , rip_ns_t_wks = 11 ,
  rip_ns_t_ptr = 12 , rip_ns_t_hinfo = 13 , rip_ns_t_minfo = 14 , rip_ns_t_mx = 15 ,
  rip_ns_t_txt = 16 , rip_ns_t_rp = 17 , rip_ns_t_afsdb = 18 , rip_ns_t_x25 = 19 ,
  rip_ns_t_isdn = 20 , rip_ns_t_rt = 21 , rip_ns_t_nsap = 22 , rip_ns_t_nsap_ptr = 23 ,
  rip_ns_t_sig = 24 , rip_ns_t_key = 25 , rip_ns_t_px = 26 , rip_ns_t_gpos = 27 ,
  rip_ns_t_aaaa = 28 , rip_ns_t_loc = 29 , rip_ns_t_nxt = 30 , rip_ns_t_eid = 31 ,
  rip_ns_t_nimloc = 32 , rip_ns_t_srv = 33 , rip_ns_t_atma = 34 , rip_ns_t_naptr = 35 ,
  rip_ns_t_kx = 36 , rip_ns_t_cert = 37 , rip_ns_t_a6 = 38 , rip_ns_t_dname = 39 ,
  rip_ns_t_sink = 40 , rip_ns_t_opt = 41 , rip_ns_t_apl = 42 , rip_ns_t_ds = 43 ,
  rip_ns_t_sshfp = 44 , rip_ns_t_ipseckey = 45 , rip_ns_t_rrsig = 46 , rip_ns_t_nsec = 47 ,
  rip_ns_t_dnskey = 48 , rip_ns_t_dhcid = 49 , rip_ns_t_nsec3 = 50 , rip_ns_t_nsec3param = 51 ,
  rip_ns_t_tlsa = 52 , rip_ns_t_smimea = 53 , rip_ns_t_hip = 55 , rip_ns_t_ninfo = 56 ,
  rip_ns_t_rkey = 57 , rip_ns_t_talink = 58 , rip_ns_t_cds = 59 , rip_ns_t_cdnskey = 60 ,
  rip_ns_t_openpgpkey = 61 , rip_ns_t_csync = 62 , rip_ns_t_spf = 99 , rip_ns_t_uinfo = 100 ,
  rip_ns_t_uid = 101 , rip_ns_t_gid = 102 , rip_ns_t_unspec = 103 , rip_ns_t_nid = 104 ,
  rip_ns_t_l32 = 105 , rip_ns_t_l64 = 106 , rip_ns_t_lp = 107 , rip_ns_t_eui48 = 108 ,
  rip_ns_t_eui64 = 109 , rip_ns_t_tkey = 249 , rip_ns_t_tsig = 250 , rip_ns_t_ixfr = 251 ,
  rip_ns_t_axfr = 252 , rip_ns_t_mailb = 253 , rip_ns_t_maila = 254 , rip_ns_t_any = 255 ,
  rip_ns_t_uri = 256 , rip_ns_t_caa = 257 , rip_ns_t_avc = 258 , rip_ns_t_ta = 32768 ,
  rip_ns_t_dlv = 32769 , rip_ns_t_max = 65536
}
 
enum  rip_ns_class_e {
  rip_ns_c_invalid = 0 , rip_ns_c_in = 1 , rip_ns_c_2 = 2 , rip_ns_c_chaos = 3 ,
  rip_ns_c_hs = 4 , rip_ns_c_none = 254 , rip_ns_c_any = 255 , rip_ns_c_max = 65536
}
 
enum  rip_ns_ext_opt_code_e { rip_ns_ext_opt_c_cs = 8 }
 

Functions

const char * rip_ns_class_to_str (rip_ns_class_t class)
 
const char * rip_ns_rr_type_to_str (rip_ns_type_t type)
 
bool rip_ns_rr_type_supported (uint16_t query_type)
 
bool rip_ns_rr_class_supported (uint16_t query_class)
 
void rip_ns_put16 (unsigned char *dst, uint16_t num)
 
int rip_ns_name_unpack (const unsigned char *msg, const unsigned char *eom, const unsigned char *src, unsigned char *dst, size_t dstsiz)
 
int rip_ns_name_pack (const unsigned char *src, unsigned char *dst, int dstsiz, const unsigned char **dnptrs, const unsigned char **lastdnptr)
 
int rip_ns_name_pton (const unsigned char *src, unsigned char *dst, size_t dstsiz)
 
int rip_ns_name_ntop (const unsigned char *src, char *dst, size_t dstsiz)
 
int rip_rr_name_get (const unsigned char *msg, const unsigned char *eom, const unsigned char *src, unsigned char *dst, size_t dstsiz, uint16_t *query_label_len)
 
int rip_ns_name_put (const unsigned char *src, unsigned char *dst, int dstsiz, const unsigned char **dnptrs, const unsigned char **lastdnptr)
 

Detailed Description

Author
Faruk Grozdanic

Copyright (c) 2025 Faruk Grozdanic

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") Copyright (c) 1996,1999 by Internet Software Consortium.

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 ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC 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.