context.c revision 1a70537f01305cb84d402c84b1ba7cc89b97a5dc
/*
* Copyright (C) 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 <assert.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "context_p.h"
#include "assert_p.h"
static void *lwres_malloc(void *, size_t);
static void lwres_free(void *, void *, size_t);
static int context_connect(lwres_context_t *);
int
{
/*
* If we were not given anything special to use, use our own
* functions. These are just wrappers around malloc() and free().
*/
}
return (LWRES_R_NOMEMORY);
/*
* Set up the context.
*/
return (LWRES_R_SUCCESS);
}
void
{
}
}
{
}
void
{
}
void
{
}
void *
{
}
static void *
{
void *mem;
(void)arg;
return (NULL);
return (mem);
}
static void
{
(void)arg;
}
static int
{
int s;
int ret;
struct sockaddr_in localhost;
if (s < 0)
return (LWRES_R_IOERROR);
if (ret != 0) {
close(s);
return (LWRES_R_IOERROR);
}
return (LWRES_R_SUCCESS);
}
int
int *recvd_len)
{
int ret;
struct sockaddr_in sin;
int fromlen;
if (ret < 0)
return (ret);
return (LWRES_R_IOERROR);
if (ret < 0)
return (LWRES_R_IOERROR);
/*
* If we got something other than what we expect, re-issue our
* recvfrom() call. This can happen if an old result comes in,
* or if someone is sending us random stuff.
*/
goto again;
return (LWRES_R_SUCCESS);
}