sock_test.c revision 1d9b3491ab3216c8f278dd821455a7a3b08ddfee
/*
* Copyright (C) 1998 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>
int sockets_active = 0;
static void
{
}
static void
{
}
static void
{
char buf[1024];
printf("Socket %s (sock %p, base %p, length %d, n %d, result %d)\n",
printf("\tFrom: %s port %d\n",
if (sockets_active == 0)
return;
}
/*
* Echo the data back
*/
} else {
}
}
static void
{
printf("my_send: %s task %p\n\t(sock %p, base %p, length %d, n %d, result %d)\n",
}
static void
{
printf("my_http_get: %s task %p\n\t(sock %p, base %p, length %d, n %d, result %d)\n",
}
static void
{
char buf[1024];
return;
}
/*
* Send a GET string, and set up to receive (and just display)
* the result.
*/
}
static void
{
printf("newcon %s (task %p, oldsock %p, newsock %p, result %d)\n",
/*
* queue another listen on this socket
*/
/*
* queue up a read on this socket
*/
} else {
return;
}
}
static void
{
}
int
{
unsigned int workers;
unsigned int addrlen;
addrlen = sizeof(struct sockaddr_in);
if (argc > 1)
else
workers = 2;
/*
* create the timer we'll need
*/
(void)isc_time_get(&now);
/*
* open up a listener socket
*/
addrlen = sizeof(struct sockaddr_in);
(int)addrlen) == ISC_R_SUCCESS);
/*
* queue up the first accept event
*/
"so1") == ISC_R_SUCCESS);
/*
* open up a socket that will connect to www.flame.org, port 80.
* Why not. :)
*/
addrlen = sizeof(struct sockaddr_in);
&so2) == ISC_R_SUCCESS);
sleep(1);
sizeof *event);
sizeof *event);
sizeof *event);
sizeof *event);
sizeof *event);
sizeof *event);
sizeof *event);
sizeof *event);
sizeof *event);
sizeof *event);
sizeof *event);
while (sockets_active > 0) {
sleep (5);
}
printf("Destroying socket manager\n");
printf("Destroying timer manager\n");
printf("Destroying task manager\n");
return (0);
}