Ripples 1.0
High Performant Software Architecture For Transaction Processing
Loading...
Searching...
No Matches
rip_ns_utils.c File Reference
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include "rip_ns_utils.h"
Include dependency graph for rip_ns_utils.c:

Functions

const char * rip_ns_rr_type_to_str (rip_ns_type_t type)
 
const char * rip_ns_class_to_str (rip_ns_class_t class)
 
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_put (const unsigned char *src, unsigned char *dst, int dstsiz, const unsigned char **dnptrs, const unsigned char **lastdnptr)
 
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_unpack (const unsigned char *msg, const unsigned char *eom, const unsigned char *src, unsigned char *dst, size_t dstsiz)
 
static int rip_dn_find (const unsigned char *domain, const unsigned char *msg, 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_pack (const unsigned char *src, unsigned char *dst, int dstsiz, const unsigned char **dnptrs, const unsigned char **lastdnptr)
 
static bool special (int ch)
 
static bool printable (int ch)
 
int rip_ns_name_ntop (const unsigned char *src, char *dst, size_t dstsiz)
 

Variables

static const char * rip_ns_rr_type_array []
 

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.

Function Documentation

◆ printable()

static bool printable ( int  ch)
inlinestatic

Thinking in non-internationalized US-ASCII (per the DNS spec), is this character visible and not a space when printed?

Note
This is a helper function for rip_ns_name_ntop()
Parameters
chCharacter to check.
Returns
Returns true if character is visible when printed, otherwise returns false.
Here is the caller graph for this function:

◆ rip_dn_find()

static int rip_dn_find ( const unsigned char *  domain,
const unsigned char *  msg,
const unsigned char **  dnptrs,
const unsigned char **  lastdnptr 
)
static

Search for the counted-label name in an array of compressed names.

DNPTRS is the pointer to the first name on the list, not the pointer to the start of the message.

Note
This is a helper function for rip_ns_name_pack().
Parameters
domainName to search for.
msgDNS message to search name in.
dnptrsSee rip_ns_name_put().
lastdnptrSee rip_ns_name_put().
Returns
Returns the offset from MSG if found, or -1.
Here is the caller graph for this function:

◆ special()

static bool special ( int  ch)
inlinestatic

Thinking in non-internationalized US-ASCII (per the DNS spec), is this character special ("in need of quoting")?

Note
This is a helper function for rip_ns_name_ntop()
Parameters
chCharacter to check.
Returns
Returns true if character needs quoting, otherwise returns false.
Here is the caller graph for this function:

Variable Documentation

◆ rip_ns_rr_type_array

const char* rip_ns_rr_type_array[]
static

Array mapping Resource Record types to enumerated rip_ns_type_e. Array is used for fast conversion from enum to string.