Commit 2b75791a authored by Lubos Slovak's avatar Lubos Slovak

Removed all references to 'CuteDNS' from project.

parent a9ad2022
......@@ -16,9 +16,9 @@
\defgroup zoneparser Zone parser utility
\defgroup ctl Control utility
\mainpage CuteDNS API documentation.
\mainpage Knot API documentation.
CuteDNS is an open-source, high-performace, purely authoritative DNS server.
Knot is an open-source, high-performace, purely authoritative DNS server.
<h2>Requirements</h2>
- liburcu (at least 0.4.5): http://lttng.org/urcu
......@@ -41,23 +41,23 @@ $ bin/zoneparser -o other-zone.db other-zone.com. other-zone.com.zone
2. Run the server with the compiled zones (use -d to run as a daemon)
\code
$ bin/cutedns example.com.db other-zone.db
$ bin/knot example.com.db other-zone.db
\endcode
<h3>Using cutectl</h3>
<h3>Using knotc</h3>
- This approach currently supports only one zone file.
- Compiled zone is stored in user's home directory.
1. Add path to cutedns and zonecompiler executables to PATH
1. Add path to knot and zoneparser executables to PATH
2. Compile zone
\code
$ bin/cutectl compile example.com. samples/example.com.zone
$ bin/knotc compile example.com. samples/example.com.zone
\endcode
3. Run the server
\code
$ bin/cutectl start
$ bin/knotc start
\endcode
<h2>Server modules</h2>
......
......@@ -9,8 +9,8 @@
* @{
*/
#ifndef __CUTEDNS_MALLOC_H__
#define __CUTEDNS_MALLOC_H__
#ifndef __KNOT_MALLOC_H__
#define __KNOT_MALLOC_H__
#include <stdlib.h>
#include "other/debug.h"
......
......@@ -67,8 +67,8 @@
* @{
*/
#ifndef _CUTEDNS_SLAB_H_
#define _CUTEDNS_SLAB_H_
#ifndef _KNOT_SLAB_H_
#define _KNOT_SLAB_H_
#include <pthread.h>
#include <stdint.h>
......@@ -329,6 +329,6 @@ void *slab_alloc_realloc(slab_alloc_t* alloc, void *ptr, size_t size);
*/
void slab_alloc_stats(slab_alloc_t* alloc);
#endif /* _CUTEDNS_SLAB_H_ */
#endif /* _KNOT_SLAB_H_ */
/*! \} */
......@@ -9,8 +9,8 @@
* @{
*/
#ifndef _CUTEDNS_COMMON_H_
#define _CUTEDNS_COMMON_H_
#ifndef _KNOT_COMMON_H_
#define _KNOT_COMMON_H_
#include <signal.h>
#include <stdint.h>
......@@ -22,8 +22,9 @@ typedef unsigned int uint;
#define PROJECT_NAME PACKAGE // Project name
#define PROJECT_VER 0x000100 // 0xMMIIRR (MAJOR,MINOR,REVISION)
#define PROJECT_EXEC "cutedns" // Project executable
#define PROJECT_EXEC "knot" // Project executable
#define ZONEPARSER_EXEC "zoneparser" // Zoneparser executable
#define PID_FILE "knot.pid"
/* Server. */
#define CPU_ESTIMATE_MAGIC 2 // Extra threads above the number of processors
......@@ -98,6 +99,6 @@ static inline int fread_safe(void *dst, size_t size, size_t n, FILE *fp)
//#define STAT_COMPILE
#endif /* _CUTEDNS_COMMON_H_ */
#endif /* _KNOT_COMMON_H_ */
/*! @} */
......@@ -12,7 +12,7 @@
char* pid_filename()
{
// Construct filename
const char* fn = "/cutedns.pid";
const char* fn = PID_FILE;
char* home = getenv("HOME");
int len = strlen(home) + strlen(fn) + 1;
char* ret = malloc(len);
......
......@@ -9,8 +9,8 @@
* @{
*/
#ifndef _CUTEDNS_PROCESS_H_
#define _CUTEDNS_PROCESS_H_
#ifndef _KNOT_PROCESS_H_
#define _KNOT_PROCESS_H_
#include <unistd.h>
......@@ -65,4 +65,4 @@ int pid_write(const char* fn);
*/
int pid_remove(const char* fn);
#endif // _CUTEDNS_PROCESS_H_
#endif // _KNOT_PROCESS_H_
......@@ -9,8 +9,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_CONSTS_H_
#define _CUTEDNS_DNSLIB_CONSTS_H_
#ifndef _KNOT_DNSLIB_CONSTS_H_
#define _KNOT_DNSLIB_CONSTS_H_
#include <stdint.h>
#include "dnslib/descriptor.h"
......@@ -80,6 +80,6 @@ static const dnslib_rr_type_t
DNSLIB_RRTYPE_RT
};
#endif /* _CUTEDNS_DNSLIB_CONSTS_H_ */
#endif /* _KNOT_DNSLIB_CONSTS_H_ */
/*! @} */
......@@ -8,8 +8,8 @@
* \addtogroup dnslib
* @{
*/
#ifndef _CUTEDNS_DNSLIB_DEBUG_H_
#define _CUTEDNS_DNSLIB_DEBUG_H_
#ifndef _KNOT_DNSLIB_DEBUG_H_
#define _KNOT_DNSLIB_DEBUG_H_
#include <stdint.h>
#include "dnslib.h"
......
......@@ -9,8 +9,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_DESCRIPTOR_H_
#define _CUTEDNS_DNSLIB_DESCRIPTOR_H_
#ifndef _KNOT_DNSLIB_DESCRIPTOR_H_
#define _KNOT_DNSLIB_DESCRIPTOR_H_
#include <stdint.h>
#include <stdbool.h>
......@@ -244,7 +244,7 @@ uint16_t dnslib_rrclass_from_string(const char *name);
*/
size_t dnslib_wireformat_size(uint wire_type);
#endif /* _CUTEDNS_DNSLIB_DESCRIPTOR_H_ */
#endif /* _KNOT_DNSLIB_DESCRIPTOR_H_ */
/*! @} */
......@@ -8,8 +8,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_DNAME_H_
#define _CUTEDNS_DNSLIB_DNAME_H_
#ifndef _KNOT_DNSLIB_DNAME_H_
#define _KNOT_DNSLIB_DNAME_H_
#include <stdint.h>
......@@ -260,6 +260,6 @@ int dnslib_dname_compare(const dnslib_dname_t *d1, const dnslib_dname_t *d2);
*/
dnslib_dname_t *dnslib_dname_cat(dnslib_dname_t *d1, const dnslib_dname_t *d2);
#endif /* _CUTEDNS_DNSLIB_DNAME_H_ */
#endif /* _KNOT_DNSLIB_DNAME_H_ */
/*! @} */
......@@ -9,8 +9,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_EDNS_H_
#define _CUTEDNS_DNSLIB_EDNS_H_
#ifndef _KNOT_DNSLIB_EDNS_H_
#define _KNOT_DNSLIB_EDNS_H_
#include <stdint.h>
......@@ -56,6 +56,6 @@ static inline void dnslib_edns_set_version(uint8_t *edns_wire, uint8_t version)
*(edns_wire + DNSLIB_EDNS_OFFSET_VERSION) = version;
}
#endif /* _CUTEDNS_DNSLIB_EDNS_H_ */
#endif /* _KNOT_DNSLIB_EDNS_H_ */
/*! @} */
......@@ -10,8 +10,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_NODE_H_
#define _CUTEDNS_DNSLIB_NODE_H_
#ifndef _KNOT_DNSLIB_NODE_H_
#define _KNOT_DNSLIB_NODE_H_
#include "dnslib/dname.h"
#include "lib/skip-list.h"
......@@ -187,6 +187,6 @@ void dnslib_node_free_tmp(dnslib_node_t **node, int free_rrsets);
*/
int dnslib_node_compare(dnslib_node_t *node1, dnslib_node_t *node2);
#endif /* _CUTEDNS_DNSLIB_NODE_H_ */
#endif /* _KNOT_DNSLIB_NODE_H_ */
/*! @} */
......@@ -9,8 +9,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_PACKET_H_
#define _CUTEDNS_DNSLIB_PACKET_H_
#ifndef _KNOT_DNSLIB_PACKET_H_
#define _KNOT_DNSLIB_PACKET_H_
#include <stdint.h>
......@@ -427,6 +427,6 @@ static inline void dnslib_packet_flags_clear_ra(uint8_t *flags2)
*flags2 &= ~RA_MASK;
}
#endif /* _CUTEDNS_DNSLIB_PACKET_H_ */
#endif /* _KNOT_DNSLIB_PACKET_H_ */
/*! @} */
......@@ -10,8 +10,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_RDATA_H_
#define _CUTEDNS_DNSLIB_RDATA_H_
#ifndef _KNOT_DNSLIB_RDATA_H_
#define _KNOT_DNSLIB_RDATA_H_
#include <stdint.h>
......@@ -234,6 +234,6 @@ const dnslib_dname_t *dnslib_rdata_dname_target(const dnslib_rdata_t *rdata);
const dnslib_dname_t *dnslib_rdata_get_name(const dnslib_rdata_t *rdata,
uint16_t type);
#endif /* _CUTEDNS_DNSLIB_RDATA_H */
#endif /* _KNOT_DNSLIB_RDATA_H */
/*! @} */
......@@ -11,8 +11,8 @@
* \addtogroup dnslib
* @{
*/
#ifndef _CUTEDNS_DNSLIB_RESPONSE_H_
#define _CUTEDNS_DNSLIB_RESPONSE_H_
#ifndef _KNOT_DNSLIB_RESPONSE_H_
#define _KNOT_DNSLIB_RESPONSE_H_
#include <stdint.h>
#include <string.h>
......@@ -336,6 +336,6 @@ void dnslib_response_free(dnslib_response_t **response);
void dnslib_response_dump(const dnslib_response_t *resp);
#endif /* _CUTEDNS_DNSLIB_RESPONSE_H_ */
#endif /* _KNOT_DNSLIB_RESPONSE_H_ */
/*! @} */
......@@ -9,8 +9,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_RRSET_H_
#define _CUTEDNS_DNSLIB_RRSET_H_
#ifndef _KNOT_DNSLIB_RRSET_H_
#define _KNOT_DNSLIB_RRSET_H_
#include <stdint.h>
......@@ -211,6 +211,6 @@ void dnslib_rrset_deep_free(dnslib_rrset_t **rrset, int free_owner,
*/
int dnslib_rrset_merge(void **r1, void **r2);
#endif /* _CUTEDNS_DNSLIB_RRSET_H_ */
#endif /* _KNOT_DNSLIB_RRSET_H_ */
/*! @} */
......@@ -9,8 +9,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_RRSIG_H_
#define _CUTEDNS_DNSLIB_RRSIG_H_
#ifndef _KNOT_DNSLIB_RRSIG_H_
#define _KNOT_DNSLIB_RRSIG_H_
#include <stdint.h>
......@@ -157,6 +157,6 @@ void dnslib_rrsig_set_deep_free(dnslib_rrsig_set_t **rrsigs, int free_owner,
*/
int dnslib_rrsig_set_merge(void **r1, void **r2);
#endif /* _CUTEDNS_DNSLIB_RRSIG_H_ */
#endif /* _KNOT_DNSLIB_RRSIG_H_ */
/*! @} */
......@@ -10,8 +10,8 @@
#include <stdint.h>
#ifndef _CUTEDNS_DNSLIB_TOLOWER_H_
#define _CUTEDNS_DNSLIB_TOLOWER_H_
#ifndef _KNOT_DNSLIB_TOLOWER_H_
#define _KNOT_DNSLIB_TOLOWER_H_
enum {
CHAR_TABLE_SIZE = 256
......@@ -281,4 +281,4 @@ static inline uint8_t dnslib_tolower(uint8_t c) {
return char_table[c];
}
#endif /* _CUTEDNS_DNSLIB_TOLOWER_H_ */
#endif /* _KNOT_DNSLIB_TOLOWER_H_ */
......@@ -9,8 +9,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_UTILS_H_
#define _CUTEDNS_DNSLIB_UTILS_H_
#ifndef _KNOT_DNSLIB_UTILS_H_
#define _KNOT_DNSLIB_UTILS_H_
#include <string.h>
......@@ -71,7 +71,7 @@ static inline void dnslib_wire_write_u32(uint8_t *pos, uint32_t data)
pos[3] = (uint8_t)(data & 0xff);
}
#endif /* _CUTEDNS_DNSLIB_UTILS_H_ */
#endif /* _KNOT_DNSLIB_UTILS_H_ */
/*! @} */
......@@ -9,8 +9,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_ZONEDUMP_H_
#define _CUTEDNS_DNSLIB_ZONEDUMP_H_
#ifndef _KNOT_DNSLIB_ZONEDUMP_H_
#define _KNOT_DNSLIB_ZONEDUMP_H_
#include "dnslib/zone.h"
......
......@@ -9,8 +9,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_ZONELOAD_H_
#define _CUTEDNS_DNSLIB_ZONELOAD_H_
#ifndef _KNOT_DNSLIB_ZONELOAD_H_
#define _KNOT_DNSLIB_ZONELOAD_H_
#include "dnslib/zone.h"
......@@ -23,5 +23,5 @@
*/
dnslib_zone_t *dnslib_zload_load(const char *filename);
#endif /* _CUTEDNS_ZONELOAD_H_ */
#endif /* _KNOT_ZONELOAD_H_ */
......@@ -9,8 +9,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_ZONE_H_
#define _CUTEDNS_DNSLIB_ZONE_H_
#ifndef _KNOT_DNSLIB_ZONE_H_
#define _KNOT_DNSLIB_ZONE_H_
#include "dnslib/node.h"
#include "dnslib/dname.h"
......
......@@ -147,7 +147,7 @@ void dnslib_zonedb_deep_free(dnslib_zonedb_t **db)
char* dnslib_zonedb_dbpath()
{
// Construct filename
const char* fn = "/cutedns.zdb";
const char* fn = "/knot.zdb";
char* home = getenv("HOME");
int len = strlen(home) + strlen(fn) + 1;
char* ret = malloc(len);
......
......@@ -12,8 +12,8 @@
* @{
*/
#ifndef _CUTEDNS_DNSLIB_ZONEDB_H_
#define _CUTEDNS_DNSLIB_ZONEDB_H_
#ifndef _KNOT_DNSLIB_ZONEDB_H_
#define _KNOT_DNSLIB_ZONEDB_H_
#include "lib/skip-list.h"
#include "dnslib/zone.h"
......@@ -102,6 +102,6 @@ char* dnslib_zonedb_dbpath();
/*----------------------------------------------------------------------------*/
#endif /* _CUTEDNS_DNSLIB_ZONEDB_H_ */
#endif /* _KNOT_DNSLIB_ZONEDB_H_ */
/*! @} */
......@@ -18,8 +18,8 @@
* \addtogroup hashing
* @{
*/
#ifndef _CUTEDNS_CUCKOO_HASH_TABLE_H_
#define _CUTEDNS_CUCKOO_HASH_TABLE_H_
#ifndef _KNOT_CUCKOO_HASH_TABLE_H_
#define _KNOT_CUCKOO_HASH_TABLE_H_
#include <stdint.h> /* uint32_t */
#include <stdlib.h> /* size_t */
......@@ -272,6 +272,6 @@ void ck_dump_table(const ck_hash_table_t *table);
/*----------------------------------------------------------------------------*/
#endif /* _CUTEDNS_CUCKOO_HASH_TABLE_H_ */
#endif /* _KNOT_CUCKOO_HASH_TABLE_H_ */
/*! @} */
......@@ -13,8 +13,8 @@
* @}
*/
#ifndef _CUTEDNS_HASH_FUNCTIONS_H_
#define _CUTEDNS_HASH_FUNCTIONS_H_
#ifndef _KNOT_HASH_FUNCTIONS_H_
#define _KNOT_HASH_FUNCTIONS_H_
typedef unsigned long int u4; /* unsigned 4-byte type */
typedef unsigned char u1; /* unsigned 1-byte type */
......@@ -33,6 +33,6 @@ unsigned long djb_hash(const unsigned char *key, int size);
unsigned long elf_hash(const unsigned char *key, int size);
#endif /* _CUTEDNS_HASH_FUNCTIONS_H_ */
#endif /* _KNOT_HASH_FUNCTIONS_H_ */
/*! @} */
......@@ -23,8 +23,8 @@
* \addtogroup hashing
* @}
*/
#ifndef _CUTEDNS_UNIVERSAL_SYSTEM_H_
#define _CUTEDNS_UNIVERSAL_SYSTEM_H_
#ifndef _KNOT_UNIVERSAL_SYSTEM_H_
#define _KNOT_UNIVERSAL_SYSTEM_H_
#include <stdint.h>
......@@ -68,6 +68,6 @@ uint32_t us_hash(uint32_t value, uint table_exp, uint fnc, uint generation);
/*----------------------------------------------------------------------------*/
#endif /* _CUTEDNS_UNIVERSAL_SYSTEM_H_ */
#endif /* _KNOT_UNIVERSAL_SYSTEM_H_ */
/*! @} */
......@@ -12,8 +12,8 @@
* \addtogroup data_structures
* @{
*/
#ifndef _CUTEDNS_DYNAMIC_ARRAY_H_
#define _CUTEDNS_DYNAMIC_ARRAY_H_
#ifndef _KNOT_DYNAMIC_ARRAY_H_
#define _KNOT_DYNAMIC_ARRAY_H_
#include <string.h>
#include <pthread.h>
......@@ -135,6 +135,6 @@ uint da_get_count(const da_array_t *array);
/*----------------------------------------------------------------------------*/
#endif /* _CUTEDNS_DYNAMIC_ARRAY_H_ */
#endif /* _KNOT_DYNAMIC_ARRAY_H_ */
/*! @} */
......@@ -41,8 +41,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Retrieved from: http://en.literateprograms.org/Skip_list_(C)?oldid=12811
*/
#ifndef _CUTEDNS_SKIP_LIST_H_
#define _CUTEDNS_SKIP_LIST_H_
#ifndef _KNOT_SKIP_LIST_H_
#define _KNOT_SKIP_LIST_H_
/*----------------------------------------------------------------------------*/
/*!
......@@ -196,6 +196,6 @@ const skip_node_t *skip_next(const skip_node_t *node);
void skip_print_list(const skip_list_t *list,
void (*print_item)(void *, void *));
#endif /* _CUTEDNS_SKIP_LIST_H_ */
#endif /* _KNOT_SKIP_LIST_H_ */
/*! \} */
......@@ -11,7 +11,7 @@
/*----------------------------------------------------------------------------*/
static volatile short s_stopping = 0;
static cute_server *s_server = NULL;
static server_t *s_server = NULL;
// SIGINT signal handler
void interrupt_handle(int s)
......@@ -31,7 +31,7 @@ void interrupt_handle(int s)
if (s == SIGINT || s == SIGTERM) {
if (s_stopping == 0) {
s_stopping = 1;
cute_stop(s_server);
server_stop(s_server);
} else {
log_error("\nOK! OK! Exiting immediately.\n");
exit(1);
......@@ -138,11 +138,11 @@ int main(int argc, char **argv)
}
// Create server instance
s_server = cute_create();
s_server = server_create();
// Run server
int res = 0;
if ((res = cute_start(s_server, zfs, zfs_count)) == 0) {
if ((res = server_start(s_server, zfs, zfs_count)) == 0) {
// Register service and signal handler
struct sigaction sa;
......@@ -161,7 +161,7 @@ int main(int argc, char **argv)
res = chdir("/");
}
if ((res = cute_wait(s_server)) != 0) {
if ((res = server_wait(s_server)) != 0) {
log_error("There was an error while waiting for server"
" to finish.\n");
}
......@@ -176,7 +176,7 @@ int main(int argc, char **argv)
}
// Stop server and close log
cute_destroy(&s_server);
server_destroy(&s_server);
// Remove PID file if daemonized
if (daemonize) {
......
......@@ -8,8 +8,8 @@
* \addtogroup debugging
* @{
*/
#ifndef _CUTEDNS_DEBUG_H_
#define _CUTEDNS_DEBUG_H_
#ifndef _KNOT_DEBUG_H_
#define _KNOT_DEBUG_H_
#include "other/log.h"
......@@ -183,6 +183,6 @@
#define debug_mem(msg...)
#endif
#endif /* _CUTEDNS_DEBUG_H_ */
#endif /* _KNOT_DEBUG_H_ */
/*! @} */
......@@ -14,8 +14,8 @@
* \addtogroup logging
* @{
*/
#ifndef _CUTEDNS_LOG_H_
#define _CUTEDNS_LOG_H_
#ifndef _KNOT_LOG_H_
#define _KNOT_LOG_H_
/*
*/
......@@ -69,6 +69,6 @@ int print_msg(int level, const char *msg, ...) __attribute__((format(printf, 2,
#define log_info(msg...) log_msg(LOG_INFO, msg)
#define log_debug(msg...) log_msg(LOG_DEBUG, msg)
#endif /* _CUTEDNS_LOG_H_ */
#endif /* _KNOT_LOG_H_ */
/*! @} */
......@@ -12,8 +12,8 @@
* @{
*/
#ifndef _CUTEDNS_PRINT_H_
#define _CUTEDNS_PRINT_H_
#ifndef _KNOT_PRINT_H_
#define _KNOT_PRINT_H_
typedef int (*printf_t)(const char *fmt, ...);
......@@ -29,6 +29,6 @@ void hex_printf(const char *data, int length, printf_t print_handler);
void bit_print(const char *data, int length);
void bit_printf(const char *data, int length, printf_t print_handler);
#endif /* _CUTEDNS_PRINT_H_ */
#endif /* _KNOT_PRINT_H_ */
/*! @} */
......@@ -21,8 +21,8 @@
* @{
*/
#ifndef _CUTEDNS_DTHREADS_H_
#define _CUTEDNS_DTHREADS_H_
#ifndef _KNOT_DTHREADS_H_
#define _KNOT_DTHREADS_H_
#include <pthread.h>
......@@ -325,7 +325,7 @@ int dt_unit_lock(dt_unit_t *unit);
*/
int dt_unit_unlock(dt_unit_t *unit);
#endif // _CUTEDNS_DTHREADS_H_
#endif // _KNOT_DTHREADS_H_
/*! @} */
......@@ -17,8 +17,8 @@
* @{
*/
#ifndef _CUTEDNS_NAME_SERVER_H_
#define _CUTEDNS_NAME_SERVER_H_
#ifndef _KNOT_NAME_SERVER_H_
#define _KNOT_NAME_SERVER_H_
#include <stdint.h>
......@@ -82,7 +82,7 @@ int ns_answer_request(ns_nameserver *nameserver,
*/
void ns_destroy(ns_nameserver **nameserver);
#endif /* _CUTEDNS_NAME_SERVER_H_ */
#endif /* _KNOT_NAME_SERVER_H_ */
/*! @} */
......@@ -15,7 +15,7 @@
#include "dnslib/debug.h"
#include "dnslib/dname.h"
cute_server *cute_create()
server_t *server_create()
{
// Create TCP+UDP sockets
debug_server("Binding sockets..\n");
......@@ -35,7 +35,7 @@ cute_server *cute_create()
debug_server("Done\n\n");
// Create server structure
cute_server *server = malloc(sizeof(cute_server));
server_t *server = malloc(sizeof(server_t));
server->handlers = NULL;
server->state = ServerIdle;
if (server == NULL) {
......@@ -71,7 +71,7 @@ cute_server *cute_create()
// Create socket handlers
debug_server("Creating UDP workers..\n");
dt_unit_t *unit = dt_create_coherent(thr_count, &udp_master, 0);
cute_create_handler(server, udp_sock, unit);
server_create_handler(server, udp_sock, unit);
debug_server("Done\n\n");
// Create TCP handlers
......@@ -83,14 +83,14 @@ cute_server *cute_create()
debug_server("Creating TCP workers..\n");
unit = dt_create(tcp_unit_size);
dt_repurpose(unit->threads[0], &tcp_master, 0);
cute_create_handler(server, tcp_sock, unit);
server_create_handler(server, tcp_sock, unit);
debug_server("Done\n\n");
return server;
}
iohandler_t *cute_create_handler(cute_server *server, int fd, dt_unit_t *unit)
iohandler_t *server_create_handler(server_t *server, int fd, dt_unit_t *unit)
{
// Create new worker
iohandler_t *handler = malloc(sizeof(iohandler_t));
......@@ -122,7 +122,7 @@ iohandler_t *cute_create_handler(cute_server *server, int fd, dt_unit_t *unit)
return handler;
}
int cute_remove_handler(cute_server *server, iohandler_t *ref)
int server_remove_handler(server_t *server, iohandler_t *ref)
{
// Find worker
iohandler_t *w = 0, *p = 0;
......@@ -162,7 +162,7 @@ int cute_remove_handler(cute_server *server, iohandler_t *ref)
return 0;
}
int cute_start(cute_server *server, char **filenames, uint zones)
int server_start(server_t *server, char **filenames, uint zones)
{
// Check server
if (server == 0) {
......@@ -201,7 +201,7 @@ int cute_start(cute_server *server, char **filenames, uint zones)
return ret;
}
int cute_wait(cute_server *server)
int server_wait(server_t *server)
{
// Wait for dispatchers to finish
int ret = 0;
......@@ -209,14 +209,14 @@ int cute_wait(cute_server *server)
debug_server("server: [%p] joining threading unit\n",
server->handlers);
ret += dt_join(server->handlers->unit);
cute_remove_handler(server, server->handlers);
server_remove_handler(server, server->handlers);
debug_server("server: joined threading unit\n");
}
return ret;
}
void cute_stop(cute_server *server)
void server_stop(server_t *server)
{
// Notify servers to stop
server->state &= ~ServerRunning;
......@@ -226,7 +226,7 @@ void cute_stop(cute_server *server)
}
}
void cute_destroy(cute_server **server)
void server_destroy(server_t **server)
{
// Check server