ctl_p.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#endif /* not lint */
/*
* Copyright (c) 1998,1999 by 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* Extern. */
#include "port_before.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <isc/assertions.h>
#include <isc/eventlib.h>
#include <isc/memcluster.h>
#include "ctl_p.h"
#include "port_after.h"
/* Constants. */
const char * const ctl_sevnames[] = {
"debug", "warning", "error"
};
/* Public. */
/*
* ctl_logger()
* if ctl_startup()'s caller didn't specify a logger, this one
* is used. this pollutes stderr with all kinds of trash so it will
* probably never be used in real applications.
*/
void
static const char me[] = "ctl_logger";
}
int
static const char me[] = "ctl_bufget";
if (!allocated_p(*buf)) {
return (-1);
}
return (0);
}
void
}
const char *
{
static const char me[] = "ctl_sa_ntop";
static const char punt[] = "[0].-1";
char tmp[INET6_ADDRSTRLEN];
case AF_INET6: {
const struct sockaddr_in6 *in6 =
(const struct sockaddr_in6 *) sa;
== NULL) {
return (punt);
}
return (punt);
}
return (buf);
}
case AF_INET: {
const struct sockaddr_in *in =
(const struct sockaddr_in *) sa;
== NULL) {
return (punt);
}
return (punt);
}
return (buf);
}
#ifndef NO_SOCKADDR_UN
case AF_UNIX: {
const struct sockaddr_un *un =
(const struct sockaddr_un *) sa;
if (x > size)
x = size;
return (buf);
}
#endif
default:
return (punt);
}
}
void
case AF_INET6:
*((struct sockaddr_in6 *)dst) =
*((const struct sockaddr_in6 *)src);
break;
case AF_INET:
*((struct sockaddr_in *)dst) =
*((const struct sockaddr_in *)src);
break;
#ifndef NO_SOCKADDR_UN
case AF_UNIX:
*((struct sockaddr_un *)dst) =
*((const struct sockaddr_un *)src);
break;
#endif
default:
break;
}
}