Commit 24d886e3 authored by Lubos Slovak's avatar Lubos Slovak

Added license text

- Also added NSD's BSD license text to descriptor.c/.h
parent 0c472603
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <stdlib.h>
#include <assert.h>
......
......@@ -8,6 +8,21 @@
* \addtogroup libknot
* @{
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_CHANGESETS_H_
#define _KNOT_CHANGESETS_H_
......
......@@ -8,6 +8,21 @@
* \addtogroup libknot
* @{
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#ifdef HAVE_LIBLDNS
......
......@@ -9,6 +9,22 @@
* @{
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_CONSTS_H_
#define _KNOT_CONSTS_H_
......
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdio.h>
#include <stdint.h>
......
/*!
* \file debug.h
*
* \author Jan Kadlec <jan.kadlec@nic.cz>
* \author Jan Kadlec <jan.kadlec.@nic.cz>
* \author Lubos Slovak <lubos.slovak@nic.cz>
*
* \brief Functions for debug output of structures.
......@@ -9,6 +9,21 @@
* \addtogroup libknot
* @{
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_DEBUG_H_
#define _KNOT_DEBUG_H_
......
/*!
* \file descriptor.c
*
* \author Jan Kadlec <jan.kadlec.@nic.cz>
* \author NSD development team
*
* \brief Contains resource record descriptor and its API
*
* \note Most of the constants and functions were taken from NSD's dns.c.
*
* \addtogroup libknot
* @{
*/
/*
* dns.c -- DNS definitions.
*
* Copyright (c) 2001-2011, NLnet Labs. All rights reserved.
*
This software is open source.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the name of the NLNET LABS nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
......
/*!
* \file descriptor.h
*
* \author Jan Kadlec <jan.kadlec@nic.cz>, most of the work by the NSD team
* \author Jan Kadlec <jan.kadlec.@nic.cz>
* \author NSD development team
*
* \brief Contains resource record descriptor and its API
*
* \note Most of the constants and functions were taken from NSD's dns.h.
*
* \todo Link to NDS's license + add license !!!
*
* \addtogroup libknot
* @{
*/
/*
* dns.h -- DNS definitions.
*
* Copyright (c) 2001-2011, NLnet Labs. All rights reserved.
*
This software is open source.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the name of the NLNET LABS nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_DESCRIPTOR_H_
#define _KNOT_DESCRIPTOR_H_
......
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <string.h>
#include <stdlib.h>
......
......@@ -9,6 +9,21 @@
* \addtogroup libknot
* @{
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_DNAME_TABLE_H_
#define _KNOT_DNAME_TABLE_H_
......
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdint.h>
#include <stdlib.h>
......
......@@ -8,6 +8,21 @@
* \addtogroup libknot
* @{
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_DNAME_H_
#define _KNOT_DNAME_H_
......
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
......
......@@ -8,6 +8,21 @@
* \addtogroup libknot
* @{
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_EDNS_H_
#define _KNOT_EDNS_H_
......
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "error.h"
#include "utils.h"
......
......@@ -8,6 +8,21 @@
* \addtogroup libknot
* @{
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_ERROR_H_
#define _KNOT_ERROR_H_
......
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
......
......@@ -18,6 +18,22 @@
* \addtogroup hashing
* @{
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_CUCKOO_HASH_TABLE_H_
#define _KNOT_CUCKOO_HASH_TABLE_H_
......
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include "hash-functions.h"
......@@ -28,25 +44,6 @@ unsigned long int fnv_hash(const char *data, int size, int bits)
return (hash ^(hash >> shift)) & mask;
}
//unsigned long int fnv_hash2(char *data, int size, int bits)
//{
// int i;
// const unsigned int p = 16777619;
// unsigned long int hash = 2166136261;
// for (i = 0; i < size; i++) {
// hash = (hash ^ data[i]) * p;
// }
// hash += hash << 13;
// hash ^= hash >> 7;
// hash += hash << 3;
// hash ^= hash >> 17;
// hash += hash << 5;
// return hash;
//}
/*------------------------------- JENKINS HASH -------------------------------*/
/* The mixing step */
......@@ -119,68 +116,3 @@ u4 jhash(register u1 *k, u4 length, u4 initval)
/*-------------------------------------------- report the result */
return c;
}
/*--------------------------------- SDBM HASH --------------------------------*/
unsigned long sdbm_hash(const unsigned char *key, int size)
{
int i = 0;
unsigned long h = 0;
while (i < size) {
h = key[i++] + (h << 6) + (h << 16) - h;
}
return h;
}
/*---------------------------------- DJB HASH --------------------------------*/
unsigned long djb_hash(const unsigned char *key, int size)
{
unsigned long h = 0;
int i;
for (i = 0; i < size; i++) {
h = 33 * h ^ key[i];
}
return h;
}
/*--------------------------------- JSW HASH ---------------------------------*/
// TODO: needs table of random numbers
//unsigned long jsw_hash( const unsigned char *key, int size )
//{
// unsigned long h = 16777551;
// int i;
//
// for ( i = 0; i < size; i++ )
// h = ( h << 1 | h >> 31 ) ^ tab[key[i]];
//
// return h;
//
//}
/*--------------------------------- ELF HASH ---------------------------------*/
unsigned long elf_hash(const unsigned char *key, int size)
{
unsigned long h = 0, g;
int i;
for (i = 0; i < size; i++) {
h = (h << 4) + key[i];
g = h & 0xf0000000L;
if (g != 0) {
h ^= g >> 24;
}
h &= ~g;
}
return h;
}
......@@ -12,6 +12,21 @@
* \addtogroup hashing
* @{
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_HASH_FUNCTIONS_H_
#define _KNOT_HASH_FUNCTIONS_H_
......@@ -34,12 +49,10 @@ typedef unsigned char u1; /* unsigned 1-byte type */
*/
unsigned long int fnv_hash(const char *data, int size, int bits);
//unsigned long int fnv_hash2(char *data, int size, int bits);
/*!
* \brief Jenkins hash function.
*
* Downloaded from ???
* Downloaded from http://burtleburtle.net/bob/hash/evahash.html
*
* \param k Data to hash
* \param length Size of the data in bytes.
......@@ -51,51 +64,6 @@ unsigned long int fnv_hash(const char *data, int size, int bits);
*/
u4 jhash(register u1 *k, u4 length, u4 initval);
/*!
* \brief SDBM hash function.
*
* Downloaded from ??? (a very similar version is here:
* http://www.partow.net/programming/hashfunctions/).
*
* \param key Key to hash.
* \param size Size of the key in bytes.
*
* \return Hash of the data.
*
* \todo Add source.
*/
unsigned long sdbm_hash(const unsigned char *key, int size);
/*!
* \brief DJB Hash (by Daniel J. Bernstein).
*
* Downloaded from ???
*
* \param key Key to hash.
* \param size Size of the key in bytes.
*
* \return Hash of the data.
*
* \todo Add source.
*/
unsigned long djb_hash(const unsigned char *key, int size);
//unsigned long jsw_hash( const unsigned char *key, int size );
/*!
* \brief ELF hash function.
*
* Downloaded from ???
*
* \param key Key to hash.
* \param size Size of the key in bytes.
*
* \return Hash of the data.
*
* \todo Add source.
*/
unsigned long elf_hash(const unsigned char *key, int size);
#endif /* _KNOTDHASH_FUNCTIONS_H_ */
/*! @} */
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <limits.h>
#include <stdint.h>
......
......@@ -23,6 +23,21 @@
* \addtogroup hashing
* @{
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_UNIVERSAL_SYSTEM_H_
#define _KNOT_UNIVERSAL_SYSTEM_H_
......
......@@ -8,6 +8,21 @@
* \addtogroup libknot
* @{
*/
/* Copyright (C) 2011 CZ.NIC Labs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License