Skip to content
Snippets Groups Projects
Commit 7596ec88 authored by Lubos Slovak's avatar Lubos Slovak
Browse files

Fixed, improved and modified documentation.

- Documentation groups now better reflect modules.
- Fixed documentation markers.
- Fixed ifdef guards.
parent 71758aff
No related branches found
No related tags found
No related merge requests found
Showing
with 82 additions and 52 deletions
......@@ -4,16 +4,16 @@
\defgroup threading Threading API.
\defgroup network Socket API.
\defgroup query_processing DNS query processing.
\defgroup utils Utilities, constants and macros.
\defgroup debugging Server debugging API.
\defgroup logging Server logging API.
\defgroup statistics Statistics module (optional).
\defgroup dnslib dnslib - Generic DNS library.
\defgroup hashing Hash table and functions.
\defgroup data_structures Other data structures.
\defgroup utils Utilities, constants and macros.
\defgroup common_lib Common library.
\defgroup alloc Memory allocation.
\defgroup statistics Statistics module (optional).
\defgroup debugging Project debugging API.
\defgroup logging Logging API.
\defgroup tests Unit tests.
\defgroup zoneparser Zone parser utility
\defgroup zoneparser Zone compiler utility
\defgroup ctl Control utility
\mainpage Knot API documentation.
......@@ -65,14 +65,20 @@ $ bin/knotc start
- \ref threading
- \ref network
- \ref query_processing
- \ref dnslib
- \ref hashing
- \ref data_structures
- \ref utils
- \ref alloc
- \ref statistics
- \ref debugging
- \ref logging
- \ref statistics
<h2>DNS library</h2>
- \ref dnslib
- \ref hashing
<h2>Common library</h2>
- \ref common_lib
- \ref alloc
<h2>Other modules</h2>
- \ref tests
......
......@@ -43,7 +43,7 @@ static int da_resize(da_array_t *array, da_resize_type_t type)
debug_da("da_resize(): array pointer: %p, items pointer: %p\n", array,
array->items);
uint new_size = ((type == DA_LARGER)
unsigned new_size = ((type == DA_LARGER)
? (array->allocated *= 2)
: (array->allocated /= 2));
......@@ -78,7 +78,7 @@ static int da_resize(da_array_t *array, da_resize_type_t type)
/* Public functions */
/*----------------------------------------------------------------------------*/
da_array_t *da_create(uint count, size_t item_size)
da_array_t *da_create(unsigned count, size_t item_size)
{
da_array_t *a = (da_array_t *)malloc(sizeof(da_array_t));
if (a == NULL) {
......@@ -91,7 +91,7 @@ da_array_t *da_create(uint count, size_t item_size)
/*----------------------------------------------------------------------------*/
int da_initialize(da_array_t *array, uint count, size_t item_size)
int da_initialize(da_array_t *array, unsigned count, size_t item_size)
{
assert(array != NULL);
pthread_mutex_init(&array->mtx, NULL);
......@@ -116,10 +116,10 @@ int da_initialize(da_array_t *array, uint count, size_t item_size)
/*----------------------------------------------------------------------------*/
int da_reserve(da_array_t *array, uint count)
int da_reserve(da_array_t *array, unsigned count)
{
pthread_mutex_lock(&array->mtx);
uint res = 0;
unsigned res = 0;
assert(array->allocated >= array->count);
if ((array->allocated - array->count) >= count) {
......@@ -136,10 +136,10 @@ int da_reserve(da_array_t *array, uint count)
/*----------------------------------------------------------------------------*/
int da_occupy(da_array_t *array, uint count)
int da_occupy(da_array_t *array, unsigned count)
{
pthread_mutex_lock(&array->mtx);
uint res = 0;
unsigned res = 0;
assert(array->allocated >= array->count);
if ((array->allocated - array->count) < count) {
......@@ -155,7 +155,7 @@ int da_occupy(da_array_t *array, uint count)
/*----------------------------------------------------------------------------*/
uint da_try_reserve(const da_array_t *array, uint count)
unsigned da_try_reserve(const da_array_t *array, unsigned count)
{
assert(array->allocated >= array->count);
if ((array->allocated - array->count) >= count) {
......@@ -167,7 +167,7 @@ uint da_try_reserve(const da_array_t *array, uint count)
/*----------------------------------------------------------------------------*/
void da_release(da_array_t *array, uint count)
void da_release(da_array_t *array, unsigned count)
{
pthread_mutex_lock(&array->mtx);
......@@ -202,7 +202,7 @@ void *da_get_items(const da_array_t *array)
/*----------------------------------------------------------------------------*/
uint da_get_count(const da_array_t *array)
unsigned da_get_count(const da_array_t *array)
{
return array->count;
}
......@@ -9,9 +9,10 @@
* Maybe some magic, or so.
* \todo This structure is too slow because of the mutex.
*
* \addtogroup data_structures
* \addtogroup common_lib
* @{
*/
#ifndef _KNOT_COMMON_DYNAMIC_ARRAY_H_
#define _KNOT_COMMON_DYNAMIC_ARRAY_H_
......@@ -53,10 +54,10 @@ struct da_array {
/*!
* \brief Size of allocated space in number of items that can be stored.
*/
uint allocated;
unsigned allocated;
/*! \brief Number of items actually stored in the array. */
uint count;
unsigned count;
/*! \brief Mutex. */
pthread_mutex_t mtx;
......@@ -74,7 +75,7 @@ typedef struct da_array da_array_t;
* \retval 0 if successful.
* \retval -1 if not successful.
*/
da_array_t *da_create(uint count, size_t item_size);
da_array_t *da_create(unsigned count, size_t item_size);
/*!
* \brief Initializes the dynamic array.
......@@ -85,7 +86,7 @@ da_array_t *da_create(uint count, size_t item_size);
* \retval 0 if successful.
* \retval -1 if not successful.
*/
int da_initialize(da_array_t *array, uint count, size_t item_size);
int da_initialize(da_array_t *array, unsigned count, size_t item_size);
/*!
* \brief Reserves space for \a count more items.
......@@ -94,7 +95,7 @@ int da_initialize(da_array_t *array, uint count, size_t item_size);
* \retval 1 if successful and the array was enlarged.
* \retval -1 if not successful - resizing was needed but could not be done.
*/
int da_reserve(da_array_t *array, uint count);
int da_reserve(da_array_t *array, unsigned count);
/*!
* \brief Increases the number of items in array by \a count.
......@@ -103,7 +104,7 @@ int da_reserve(da_array_t *array, uint count);
* \retval -1 If not successful (not enough allocated space, i.e. must run
* da_reserve()).
*/
int da_occupy(da_array_t *array, uint count);
int da_occupy(da_array_t *array, unsigned count);
/*!
* \brief Tries to reserve space for \a count more items.
......@@ -111,12 +112,12 @@ int da_occupy(da_array_t *array, uint count);
* \retval 0 if successful and resizing is not necessary.
* \retval 1 if successful but the array will need to be resized.
*/
uint da_try_reserve(const da_array_t *array, uint count);
unsigned da_try_reserve(const da_array_t *array, unsigned count);
/*!
* \brief Releases space taken by \a count items.
*/
void da_release(da_array_t *array, uint count);
void da_release(da_array_t *array, unsigned count);
/*!
* \brief Poperly deallocates the array.
......@@ -131,7 +132,7 @@ void *da_get_items(const da_array_t *array);
/*!
* \brief Returns count of items in the array.
*/
uint da_get_count(const da_array_t *array);
unsigned da_get_count(const da_array_t *array);
/*----------------------------------------------------------------------------*/
......
......@@ -8,9 +8,10 @@
* Selected calls latency profiler is enabled with PROF_LATENCY define.
* You can roughly profile own code with perf_begin() and perf_end() macros.
*
* \addtogroup utils
* \addtogroup common_lib
* @{
*/
#ifndef _KNOT_COMMON_LATENCY_H_
#define _KNOT_COMMON_LATENCY_H_
......@@ -95,3 +96,5 @@ int pf_pthread_mutex_unlock(pthread_mutex_t *mutex,
#endif // PROF_LATENCY
#endif // _KNOT_COMMON_LATENCY_H_
/*! @} */
......@@ -8,7 +8,7 @@
* Downloaded hex_print, bit_print from http://www.digitalpeer.com/id/print
* Updated with generic printf handler.
*
* \addtogroup utils
* \addtogroup common_lib
* @{
*/
......
......@@ -11,8 +11,8 @@
* Original retrieved from http://en.literateprograms.org/Skip_list_(C)?oldid=12811
* Modifications by Lubos Slovak, 2010
*
* \addtogroup data_structures
* \{
* \addtogroup common_lib
* @{
*/
/* Copyright (c) 2010 the authors listed at the following URL, and/or
......@@ -198,4 +198,4 @@ void skip_print_list(const skip_list_t *list,
#endif /* _KNOT_COMMON_SKIP_LIST_H_ */
/*! \} */
/*! @} */
......@@ -8,6 +8,7 @@
* \addtogroup alloc
* @{
*/
#ifndef _KNOT_COMMON_ALLOC_COMMON_H_
#define _KNOT_COMMON_ALLOC_COMMON_H_
......
......@@ -24,3 +24,5 @@
void usage_dump();
#endif // _KNOT_COMMON_MALLOC_H_
/*! @} */
......@@ -331,4 +331,4 @@ void slab_alloc_stats(slab_alloc_t* alloc);
#endif /* _KNOT_COMMON_SLAB_H_ */
/*! \} */
/*! @} */
......@@ -9,6 +9,7 @@
* \addtogroup dnslib
* @{
*/
#ifndef _KNOT_DNSLIB_DEBUG_H_
#define _KNOT_DNSLIB_DEBUG_H_
......
......@@ -2,11 +2,12 @@
* \file descriptor.h
*
* \author Jan Kadlec <jan.kadlec@nic.cz>, most of the work by the NSD team
* TODO link to NDS's license + add license !!!
*
* \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 dnslib
* @{
......
/*!
* \file dname.h
*
* \author Lubos Slovak <lubos.slovak@nic.cz>
*
* \brief Domain name structure and API for manipulating it.
......
......@@ -8,6 +8,7 @@
* \addtogroup dnslib
* @{
*/
#ifndef _KNOT_DNSLIB_COMMON_H_
#define _KNOT_DNSLIB_COMMON_H_
......
/*
* File: dnslib.h
* Date: 02.12.2010 12:37
* Author: jan
* Project:
* Description:
/*!
* \file dnslib.h
*
* \author Jan Kadlec <jan.kadlec@nic.cz>
*
* \brief Convenience header for including whole dnslib.
*
* \addtogroup dnslib
* @{
*/
#ifndef __DNSLIB_H__
#define __DNSLIB_H__
#ifndef _KNOT_DNSLIB_DNSLIB_H_
#define _KNOT_DNSLIB_DNSLIB_H_
#include "dnslib/consts.h"
#include "dnslib/descriptor.h"
......@@ -31,4 +33,4 @@
#endif
/* end of file dnslib.h */
/*! @} */
/*!
* \file error.h
*
* \author Lubos Slovak <lubos.slovak@nic.cz>
*
* \brief Error codes and function for getting error message.
......
......@@ -10,7 +10,7 @@
* \todo Add references to sources.
*
* \addtogroup hashing
* @}
* @{
*/
#ifndef _KNOT_HASH_FUNCTIONS_H_
......
......@@ -21,8 +21,9 @@
* \todo Check out some better random number generator.
*
* \addtogroup hashing
* @}
* @{
*/
#ifndef _KNOT_UNIVERSAL_SYSTEM_H_
#define _KNOT_UNIVERSAL_SYSTEM_H_
......
......@@ -11,6 +11,7 @@
* \addtogroup dnslib
* @{
*/
#ifndef _KNOT_DNSLIB_RESPONSE_H_
#define _KNOT_DNSLIB_RESPONSE_H_
......
/*!
* \file tolower.h
*
* \author Lubos Slovak <lubos.slovak@nic.cz>
*
* \brief Table for converting ASCII characters to lowercase.
......@@ -8,11 +9,11 @@
* @{
*/
#include <stdint.h>
#ifndef _KNOT_DNSLIB_TOLOWER_H_
#define _KNOT_DNSLIB_TOLOWER_H_
#include <stdint.h>
#define KNOT_CHAR_TABLE_SIZE 256
enum {
......
......@@ -9,6 +9,9 @@
* @{
*/
#ifndef _KNOT_DNSLIB_ZONE_DUMP_TEXT_H_
#define _KNOT_DNSLIB_ZONE_DUMP_TEXT_H_
#include "dnslib/descriptor.h"
#include "dnslib/zone.h"
......@@ -22,3 +25,7 @@
* \retval -1 on error.
*/
int zone_dump_text(dnslib_zone_t *zone, const char *filename);
#endif // _KNOT_DNSLIB_ZONE_DUMP_TEXT_H_
/*! @} */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment