Commit 20f1bc44 authored by Michael Graff's avatar Michael Graff
Browse files

somehow, new files got committed to mainline, and changes to my branch. ...

somehow, new files got committed to mainline, and changes to my branch.  Remove them from the mainline for now.
parent ea964e3e
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="isc/bind">
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
background-color: #ffffff;
color: #000000;
}
table {
border-collapse: collapse;
}
tr.rowh {
text-align: center;
border: 1px solid #000000;
background-color: #8080ff;
color: #ffffff;
}
tr.row {
text-align: right;
border: 1px solid #000000;
background-color: teal;
color: #ffffff;
}
tr.lrow {
text-align: left;
border: 1px solid #000000;
background-color: teal;
color: #ffffff;
}
.header {
background-color: teal;
color: #ffffff;
padding: 4px;
}
.content {
background-color: #ffffff;
color: #000000;
padding: 4px;
}
.item {
padding: 4px;
align: right;
}
.value {
padding: 4px;
font-weight: bold;
}
</style>
<title>BIND 9 Statistics</title>
</head>
<body>
<div class="header">Bind 9 Configuration and Statistics Report</div>
<br/>
<table>
<tr class="rowh">
<th colspan="2">Zone Configuration Parameters</th>
</tr>
<tr class="row"><td>
<span class="item">Maximum transfers in:</span>
</td><td>
<span class="value">
<xsl:value-of select="statistics/zonemanager/config/transfersin"/>
</span>
</td></tr>
<tr class="row"><td>
<span class="item">Transfers per name server:</span>
</td><td>
<span class="value">
<xsl:value-of
select="statistics/zonemanager/config/transfersperns"/>
</span>
</td></tr>
<tr class="row"><td>
<span class="item">Serial query rate:</span>
</td><td>
<span class="value">
<xsl:value-of
select="statistics/zonemanager/config/serialqueryrate"/>
</span>
</td></tr>
<tr class="row"><td>
<span class="item">I/O limit:</span>
</td><td>
<span class="value">
<xsl:value-of
select="statistics/zonemanager/config/iolimit"/>
</span>
</td></tr>
</table>
<br />
<table>
<tr class="rowh">
<th colspan="2">Current Zone Statistics</th>
</tr>
<tr class="row"><td>
<span class="item">Transfers Active:</span>
</td><td>
<span class="value">
<xsl:value-of select="statistics/zonemanager/status/ioactive"/>
</span>
</td></tr>
</table>
<br />
<table>
<tr class="rowh"><th colspan="2">Zone List</th></tr>
<tr class="rowh"><th>Name</th><th>Serial</th></tr>
<xsl:for-each select="/isc/bind/statistics/zonemanager/zones/zone">
<tr class="lrow">
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="serial"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
#!/usr/bin/env perl
use strict;
use warnings;
print 'char *msg = "';
my $lines = '';
while (<>) {
chomp;
$lines .= $_;
}
$lines =~ s/[\ \t]+/ /g;
$lines =~ s/\>\ \</\>\</g;
$lines =~ s/\"/\\\"/g;
print $lines;
print '\\n";', "\n";
This diff is collapsed.
/*
* Copyright (C) 2006 Internet Systems Consortium, Inc. ("ISC")
*
* 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
/* $Id: httpd.h,v 1.2 2006/11/13 20:07:57 explorer Exp $ */
#ifndef ISC_HTTPD_H
#define ISC_HTTPD_H 1
/*! \file */
#include <isc/event.h>
#include <isc/eventclass.h>
#include <isc/types.h>
#include <isc/mutex.h>
#include <isc/task.h>
#define HTTPD_EVENTCLASS ISC_EVENTCLASS(4300)
#define HTTPD_SHUTDOWN (HTTPD_EVENTCLASS + 0x0001)
#define ISC_HTTPDMGR_FLAGSHUTTINGDOWN 0x00000001
/*
* Create a new http daemon which will send, once every time period,
* a http-like header followed by HTTP data.
*/
isc_result_t
isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *socket, isc_task_t *task,
isc_timermgr_t *tmgr, isc_httpdmgr_t **httpdp);
void
isc_httpdmgr_shutdown(isc_httpdmgr_t **httpdp);
isc_result_t
isc_httpdmgr_addurl(isc_httpdmgr_t *httpdmgr, const char *url,
isc_httpdaction_t func, void *arg);
isc_result_t
isc_httpd_response(isc_httpd_t *httpd);
isc_result_t
isc_httpd_addheader(isc_httpd_t *httpd, const char *name,
const char *val);
isc_result_t
isc_httpd_addheaderuint(isc_httpd_t *httpd, const char *name, int val);
isc_result_t isc_httpd_endheaders(isc_httpd_t *httpd);
#endif /* ISC_HTTPD_H */
/*
* Copyright (C) 2006 Internet Systems Consortium, Inc. ("ISC")
*
* 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
/* $Id: mib.h,v 1.2 2006/11/13 20:07:57 explorer Exp $ */
#ifndef ISC_MIB_H
#define ISC_MIB_H
/*! \file mib.h
* \brief Statistics structures.
*
* \li MP:
* The statistics structures defined in this file handle all locking
* provided the API is used properly.
*
* This module defines a MIB database.
*
* Two entities are defined: providers and consumers. Providers will
* create and attach mib elements to the root or to other nodes, and update
* the MIB elements themselves. Consumers will read this data.
*
* Note that consumers cannot currently update the MIB, just read it. We
* may want to add this later.
*
* General assumptions about the use of the mib system, and design
* requirements:
*
* (1) Mib must be fast to update, with as little locking as feasable.
* On simple integers, this should require no locks if the system
* supports atomic increments and reads of integers.
*
* (2) Mib must be fast to read, also with as little locking as possible.
* The mib tree has a read/write lock to protect the structure of
* the entire mib tree.
*
* (3) The mib tree itself is expected to be updated infrequently, and
* so a simple read/write lock is used to protect the struture.
*
* (4) Sometimes complicated data will require special handling to protect
* during read or updates. When this is necessary, a pointer to a lock
* structure can be associated with each mib variable. This lock
* can be shared (for space savings).
*
* Constraints of use:
*
* (1) Each mib structure has an implied owner, which may be a module, an
* "object" like a zone, or other distinct object. It is required the
* owner of the mib node will be the one to create, modify the structure
* of, and delete it as needed.
*
* (2) The mib structure must be fully configured before inserting it into
* the tree. However, mib objects can be added and removed dynamically
* as required.
*
* (3) Mib have names. These names cannot contain periods, as this is
* used as the delimiter between names.
*
* (4) Walking a list of nodes must be done in the forward order only, never
* in the reverse direction. This is to avoid deadlocks, and to optimize
* locking. Locking will only be performed as needed while walking the
* mibnode list, and if the lock needed does not change it will not
* be unlocked until isc_mib_iterunlock() is called to explicitly
* unlock, or isc_mib_iterdestroy() is called to implicitly unlock it.
*
* (5) When walking the tree, or updating statistics, it is required that
* the mibnode locks be held for as little a time as possible. Any
* data should be copied quickly or the lock should be explicitly
* released.
*
* (6) When updating mib, the mibnode lock should be held as little as
* possible.
*
* (7) Even with locks there is no guarantee they will always be used, so
* users of this cannot assume reading two or more variables which
* share the same statistics lock will result in consistent data. For
* example, if there are three data items, "a", "b", and "total", where
* total = a + b, it is possible "a" will be updated using atomic
* operations, and then "total" will be incremented using the same
* operations. Atomic operations on integers will not always use the
* node's lock, so it is possible that total will not always be the sum
* of "a" and "b".
*
* (8) Consumers are read-only -- no modification is allowed. Search
* functions will return data that must not be modified. Removal of
* a node implies that the node's exact pointer is known. That is,
* no search is needed. Searching then removing a node is considered
* a misuse of this API.
*/
#include <isc/lang.h>
#include <isc/list.h>
#include <isc/mutex.h>
#include <isc/refcount.h>
#include <isc/rwlock.h>
#include <isc/types.h>
#define ISC_MIB_MAXNAME 12 /* max mib length */
#define ISC_MIB_NAMELEN 32 /* longest ASCII name length per node */
#define ISC_MIB_DEFSIZE 8 /* default object set size */
/*
* Node types.
*/
#define ISC_MIBNODETYPE_INVALID 0 /* Invalid node */
#define ISC_MIBNODETYPE_NODE 1 /* node is a node */
#define ISC_MIBNODETYPE_UINT32 2 /* node is an unsigned 32-bit integer */
#define ISC_MIBNODETYPE_INT32 3 /* node is an signed 32-bit integer */
#define ISC_MIBNODETYPE_UINT64 4 /* node is an unsigned 64-bit integer */
#define ISC_MIBNODETYPE_INT64 5 /* node is an signed 64-bit integer */
#define ISC_MIBNODETYPE_STRING 6 /* node is a string */
/*
* Node flags. These define flags used on isc_mibnode_t.
*/
#define ISC_MIBNODEFLAG_PERMANENT 0x00000001 /* cannot free */
typedef struct isc_mibnode isc_mibnode_t;
typedef struct isc_mib isc_mib_t;
/*
* This is a description of the data element we are tracking. We call this
* a "node."
*/
struct isc_mibnode {
isc_uint32_t type;
isc_uint32_t flags;
char *name;
isc_mibnode_t *parent;
isc_mutex_t *lock;
void *data; /* used if we are a data node */
ISC_LIST(isc_mibnode_t) nodes; /* used if we are a list node */
ISC_LINK(isc_mibnode_t) link;
};
/*
* Initialize a tree's root node.
*/
isc_result_t isc_mib_create(isc_mem_t *mem, isc_mib_t **rootp);
/*
* Destroy a MIB.
*/
void isc_mib_destroy(isc_mib_t **rootp);
/*
* FUNCTIONS BELOW THIS POINT SHOULD BE CALLED ONLY FROM PROVIDERS.
*/
/*
* Create and initialize a new node. This will allocate a node structure,
* and call isc_mibnode_init() to initialize it.
*
* This function allocates memory, so a corresponding call to
* isc_mibnode_destroy() must be made to free the memory allocated by
* this function and by isc_mibnode_init().
*/
isc_result_t isc_mibnode_create(isc_mib_t *mib, isc_uint32_t type,
const char *name,
isc_uint32_t flags, isc_mutex_t *lock,
void *item, unsigned int itemlen,
isc_mibnode_t **nodep);
/*
* Initialize a static or pre-allocated node.
* This will set it up but NOT link it into the tree.
*
* This function allocates memory from the mib's memory context, so a
* call to isc_mibnode_invalidate() must be called to destroy it.
*/
isc_result_t isc_mibnode_init(isc_mib_t *mib, isc_mibnode_t *node,
isc_uint32_t type, const char *name,
isc_mutex_t *lock, isc_uint32_t flags,
void *item, unsigned int itemlen);
void isc_mibnode_invalidate(isc_mib_t *mib, isc_mibnode_t *node);
void isc_mib_add(isc_mib_t *root, isc_mibnode_t *parent, isc_mibnode_t *node);
void isc_mib_remove(isc_mib_t *root, isc_mibnode_t *node);
void isc_mibnode_destroy(isc_mib_t *mib, isc_mibnode_t **nodep);
isc_boolean_t isc_mibnode_haschildren(isc_mibnode_t *node);
/*
* Walk a mib. This performs a depth-first traversal of the mib tree.
* Locking is automatic. After walking is completed, isc_mib_release()
* must be called.
*
* Also, have a way to find a node's parent.
*/
isc_mibnode_t *isc_mib_firstnode(isc_mib_t *mib, isc_mibnode_t *parent);
isc_mibnode_t *isc_mib_nextnode(isc_mib_t *mib, isc_mibnode_t *previous);
isc_mibnode_t *isc_mib_parent(isc_mib_t *mib, isc_mibnode_t *node);
/*
* Release any locks held on the mib and node.
* This is the last step in searching and tree-walking.
*
* If 'node' is NULL, only the tree is unlocked.
*/
void isc_mib_unlock(isc_mib_t *mib, isc_mibnode_t *node);
void isc_mib_lock(isc_mib_t *mib, isc_mibnode_t *node);
void
isc_mibnode_getdata(isc_mibnode_t *node,
isc_mibnode_t *previous,
isc_boolean_t lock,
void *item, unsigned int itemlen);
#endif /* ISC_MIB_H */
/*
* Copyright (C) 2006 Internet Systems Consortium, Inc. ("ISC")
*
* 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
/* $Id: mib.c,v 1.2 2006/11/13 20:07:57 explorer Exp $ */
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <isc/atomic.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/mib.h>
#include <isc/util.h>
#include <isc/list.h>
/*
* The root of a statistics tree.
*
* We use a isc_refcount_t for reference counting, which is a self-locked
* type. It is very efficient and may use atomic operations rather than
* locks.
*/
struct isc_mib {
isc_mem_t *mem;
isc_rwlock_t rwlock;
ISC_LIST(isc_mibnode_t) nodes;
isc_refcount_t refs;
};
isc_result_t
isc_mib_create(isc_mem_t *mem, isc_mib_t **rootp)
{
isc_result_t result;
isc_mib_t *root;
REQUIRE(rootp != NULL && *rootp == NULL);
root = isc_mem_get(mem, sizeof *root);
if (root == NULL)
return (ISC_R_NOMEMORY);
result = isc_rwlock_init(&root->rwlock, 0, 0);
if (result != ISC_R_SUCCESS) {
isc_mem_put(mem, root, sizeof *root);
return (result);
}
ISC_LIST_INIT(root->nodes);
root->mem = NULL;
isc_mem_attach(mem, &root->mem);
isc_refcount_init(&root->refs, 1);
*rootp = root;
return (ISC_R_SUCCESS);
}
isc_result_t
isc_mibnode_create(isc_mib_t *mib, isc_uint32_t type,
const char *name, isc_uint32_t flags,
isc_mutex_t *lock, void *item, unsigned int itemlen,
isc_mibnode_t **nodep)
{
isc_result_t result;
isc_mibnode_t *node;
REQUIRE(nodep != NULL && *nodep == NULL);
REQUIRE((flags & ISC_MIBNODEFLAG_PERMANENT) == 0);
node = isc_mem_get(mib->mem, sizeof *node);
if (node == NULL)
return (ISC_R_NOMEMORY);
*nodep = node;
result = isc_mibnode_init(mib, node, type, name, lock, flags,
item, itemlen);
return (result);
}
void
isc_mibnode_destroy(isc_mib_t *mib, isc_mibnode_t **nodep)
{
isc_mibnode_t *node;
REQUIRE(nodep != NULL && *nodep != NULL);
node = *nodep;
REQUIRE((node->flags & ISC_MIBNODEFLAG_PERMANENT) == 0);
isc_mibnode_invalidate(mib, node);
*nodep = NULL;
isc_mem_put(mib->mem, node, sizeof *node);
}
/*
* XXXMLG Should break this out into two functions, one which is used
* internally for most of the setting, and another which simply makes
* certain that the ISC_MIBNODEFLAG_PERMANENT is set when the client calls
* _init() and _invalidate() directly.
*/
void
isc_mibnode_invalidate(isc_mib_t *mib, isc_mibnode_t *node)
{
REQUIRE(node != NULL);
REQUIRE(!ISC_LINK_LINKED(node, link));
switch (node->type) {
case ISC_MIBNODETYPE_NODE:
REQUIRE(ISC_LIST_EMPTY(node->nodes));
break;
}
isc_mem_free(mib->mem, node->name);
node = ISC_MIBNODETYPE_INVALID;
}
/*
* Initialize a statically allocated mibnode. The caller will need to call
* isc_mibnode_invalidate() after it is no longer in use.
*/
isc_result_t
isc_mibnode_init(isc_mib_t *mib, isc_mibnode_t *node, isc_uint32_t type,
const char *name, isc_mutex_t *lock, isc_uint32_t flags,
void *item, unsigned int itemlen)
{
REQUIRE(mib != NULL);
REQUIRE(node != NULL);
REQUIRE(name != NULL);
ISC_LINK_INIT(node, link);
node->type = type;
node->name = isc_mem_strdup(mib->mem, name);
if (node->name == NULL)
return (ISC_R_NOMEMORY);
node->parent = NULL;
node->lock = NULL;
node->flags = flags;
node->lock = lock;
ISC_LIST_INIT(node->nodes);
switch (type) {
case ISC_MIBNODETYPE_NODE:
break;
case ISC_MIBNODETYPE_STRING:
REQUIRE(itemlen >= sizeof(char *));
node->data = item;
break;
case ISC_MIBNODETYPE_UINT32:
case ISC_MIBNODETYPE_INT32:
REQUIRE(itemlen >= sizeof(isc_uint32_t));
node->data = item;
break;
case ISC_MIBNODETYPE_UINT64:
case ISC_MIBNODETYPE_INT64:
REQUIRE(itemlen >= sizeof(isc_uint64_t));
node->data = item;
break;
default:
isc_error_runtimecheck(__FILE__, __LINE__,
"Invalid type");
}
return (ISC_R_SUCCESS);
}
void