unbound 0.1
asynclook.c File Reference

This program shows the results from several background lookups, while printing time in the foreground. More...

#include "config.h"
#include "libunbound/unbound.h"
#include "libunbound/context.h"
#include "util/locks.h"
#include "util/log.h"
#include "sldns/rrdef.h"

Data Structures

struct  track_id
 keeping track of the async ids More...
struct  lookinfo
 result list for the lookups More...
struct  ext_thr_info
 struct for extended thread info More...

Macros

#define NUMTHR   10
 number of threads to make in extended test

Functions

static void usage (char *argv[])
 usage information for asynclook
static void print_result (struct lookinfo *info)
 print result from lookup nicely
static void lookup_is_done (void *mydata, int err, struct ub_result *result)
 this is a function of type ub_callback_t
static void checkerr (const char *desc, int err)
 check error, if bad, exit with error message
static void ext_check_result (const char *desc, int err, struct ub_result *result)
 check result structure for the 'correct' answer
static void ext_callback (void *mydata, int err, struct ub_result *result)
 extended bg result callback, this function is ub_callback_t
static void * ext_thread (void *arg)
 extended thread worker
static int ext_test (struct ub_ctx *ctx, int argc, char **argv)
 perform extended threaded test
int main (int argc, char **argv)
 main program for asynclook

Variables

static int num_wait = 0
 global variable to see how many queries we have left
static int q_is_localhost = 0
 if true, we are testing against 'localhost' and extra checking is done
int optind
 getopt global, in case header files fail to declare it.
char * optarg
 getopt global, in case header files fail to declare it.

Detailed Description

This program shows the results from several background lookups, while printing time in the foreground.

Macro Definition Documentation

◆ NUMTHR

#define NUMTHR   10

number of threads to make in extended test

Referenced by ext_test(), and ext_thread().

Function Documentation

◆ usage()

void usage ( char * argv[])
static

usage information for asynclook

References usage().

◆ print_result()

void print_result ( struct lookinfo * info)
static

◆ lookup_is_done()

void lookup_is_done ( void * mydata,
int err,
struct ub_result * result )
static

this is a function of type ub_callback_t

References lookinfo::err, lookup_is_done(), lookinfo::name, num_wait, and lookinfo::result.

Referenced by lookup_is_done(), and main().

◆ checkerr()

void checkerr ( const char * desc,
int err )
static

check error, if bad, exit with error message

References checkerr(), lookinfo::err, and ub_strerror().

Referenced by checkerr(), ext_check_result(), ext_thread(), and main().

◆ ext_check_result()

◆ ext_callback()

void ext_callback ( void * mydata,
int err,
struct ub_result * result )
static

◆ ext_thread()

◆ ext_test()

int ext_test ( struct ub_ctx * ctx,
int argc,
char ** argv )
static

◆ main()

Variable Documentation

◆ num_wait

int num_wait = 0
static

global variable to see how many queries we have left

Referenced by lookup_is_done(), and main().

◆ q_is_localhost

int q_is_localhost = 0
static

if true, we are testing against 'localhost' and extra checking is done

Referenced by ext_check_result(), and ext_test().