dispatch_test.c revision ce04ac20088ace70907c1a26b8e2acf404ba6f8a
/*
* Copyright (C) 1998, 1999 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM 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.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <isc/assertions.h>
#include <dns/dispatch.h>
#include "printmsg.h"
void start_response(void);
static inline void CHECKRESULT(dns_result_t, char *);
static inline void
{
if (result != DNS_R_SUCCESS) {
exit(1);
}
}
void
start_response(void)
{
printf("--- adding response\n");
== ISC_R_SUCCESS);
printf("--- removing response\n");
}
void
{
}
void
{
static int cnt = 0;
printf("App: Got packet. Result: %s\n",
printf("Got error, terminating application\n");
return;
}
sleep (2);
printf("App: Ready.\n");
cnt++;
switch (cnt) {
case 6:
printf("--- removing request\n");
printf("--- destroying dispatcher\n");
break;
case 3:
printf("--- removing request\n");
printf("--- adding request\n");
== DNS_R_SUCCESS);
break;
default:
break;
}
}
int
{
(void)argc;
(void)argv;
/*
* EVERYTHING needs a memory context.
*/
/*
* The task manager is independent (other than memory context)
*/
/*
* Open up a random socket. Who cares where.
*/
/*
* Create a dispatch context
*/
&resp) == ISC_R_SUCCESS);
isc_app_run();
return (0);
}