dispatch_tcp_test.c revision 5d1bfe4ce1ac278b69c3d1468ed469c5d2080264
/*
* Copyright (C) 1998, 1999, 2000 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 <stdlib.h>
#include <unistd.h>
#include <dns/dispatch.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
isc_task_t *t0;
unsigned char render_buffer[1024];
void start_response(void);
static inline void CHECKRESULT(isc_result_t, char *);
void hex_dump(isc_buffer_t *);
static isc_result_t
unsigned char text[8192];
int result;
if (result != ISC_R_SUCCESS)
return (result);
return (ISC_R_SUCCESS);
}
void
hex_dump(isc_buffer_t *b) {
unsigned int len;
isc_region_t r;
isc_buffer_remainingregion(b, &r);
printf("Buffer %p (%p, %d): used region base %p, length %d",
if (len % 16 == 0)
printf("\n");
}
printf("\n");
}
static inline void
if (result != ISC_R_SUCCESS) {
exit(1);
}
}
void
unsigned int attrs;
}
/*
* Create a dispatch context
*/
attrs = 0;
== ISC_R_SUCCESS);
&resp)
== ISC_R_SUCCESS);
}
void
(void)task;
printf("Send done (SUCCESS)\n");
return;
}
printf("--- removing response (FAILURE)\n");
}
void
start_response(void) {
unsigned char namebuf[255];
#define QUESTION "flame.org."
#ifdef ISC_PLATFORM_HAVESALEN
#endif
&target);
printf("--- adding response\n");
}
void
(void)task;
printf("App: Got response (id %d). Result: %s\n",
printf("--- removing response\n");
}
void
static int cnt = 0;
printf("App: Got request. Result: %s\n",
printf("Got error, terminating application\n");
return;
}
sleep (1);
printf("App: Ready.\n");
cnt++;
switch (cnt) {
case 6:
printf("--- removing request\n");
break;
case 3:
printf("--- removing request\n");
printf("--- adding request\n");
== ISC_R_SUCCESS);
break;
default:
break;
}
}
int
(void)argc;
(void)argv;
/*
* EVERYTHING needs a memory context.
*/
/*
* The task manager is independent (other than memory context)
*/
dispatchmgr = NULL;
== ISC_R_SUCCESS);
/*
* Open up a random socket. Who cares where.
*/
isc_sockettype_tcp, &s0) ==
== ISC_R_SUCCESS);
isc_app_run();
sleep(2);
sleep(2);
sleep(2);
sleep(2);
sleep(2);
#if 0
sleep(2);
#endif
return (0);
}