mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
style cleanup
clean up style in rndc and the control channel in preparation for changing them to use the new network manager.
This commit is contained in:
@@ -198,8 +198,8 @@ maybe_free_connection(controlconnection_t *conn) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
shutdown_listener(controllistener_t *listener) {
|
shutdown_listener(controllistener_t *listener) {
|
||||||
controlconnection_t *conn;
|
controlconnection_t *conn = NULL;
|
||||||
controlconnection_t *next;
|
controlconnection_t *next = NULL;
|
||||||
|
|
||||||
if (!listener->exiting) {
|
if (!listener->exiting) {
|
||||||
char socktext[ISC_SOCKADDR_FORMATSIZE];
|
char socktext[ISC_SOCKADDR_FORMATSIZE];
|
||||||
@@ -341,7 +341,7 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
|
|||||||
isc_stdtime_t now;
|
isc_stdtime_t now;
|
||||||
isc_buffer_t b;
|
isc_buffer_t b;
|
||||||
isc_region_t r;
|
isc_region_t r;
|
||||||
isc_buffer_t *text;
|
isc_buffer_t *text = NULL;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_result_t eresult;
|
isc_result_t eresult;
|
||||||
isccc_sexpr_t *_ctrl = NULL;
|
isccc_sexpr_t *_ctrl = NULL;
|
||||||
@@ -573,7 +573,7 @@ control_timeout(isc_task_t *task, isc_event_t *event) {
|
|||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
newconnection(controllistener_t *listener, isc_socket_t *sock) {
|
newconnection(controllistener_t *listener, isc_socket_t *sock) {
|
||||||
controlconnection_t *conn;
|
controlconnection_t *conn = NULL;
|
||||||
isc_interval_t interval;
|
isc_interval_t interval;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
@@ -631,7 +631,7 @@ static void
|
|||||||
control_newconn(isc_task_t *task, isc_event_t *event) {
|
control_newconn(isc_task_t *task, isc_event_t *event) {
|
||||||
isc_socket_newconnev_t *nevent = (isc_socket_newconnev_t *)event;
|
isc_socket_newconnev_t *nevent = (isc_socket_newconnev_t *)event;
|
||||||
controllistener_t *listener = event->ev_arg;
|
controllistener_t *listener = event->ev_arg;
|
||||||
isc_socket_t *sock;
|
isc_socket_t *sock = NULL;
|
||||||
isc_sockaddr_t peeraddr;
|
isc_sockaddr_t peeraddr;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
@@ -693,8 +693,8 @@ cleanup:
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
controls_shutdown(named_controls_t *controls) {
|
controls_shutdown(named_controls_t *controls) {
|
||||||
controllistener_t *listener;
|
controllistener_t *listener = NULL;
|
||||||
controllistener_t *next;
|
controllistener_t *next = NULL;
|
||||||
|
|
||||||
for (listener = ISC_LIST_HEAD(controls->listeners); listener != NULL;
|
for (listener = ISC_LIST_HEAD(controls->listeners); listener != NULL;
|
||||||
listener = next)
|
listener = next)
|
||||||
@@ -717,9 +717,9 @@ named_controls_shutdown(named_controls_t *controls) {
|
|||||||
static isc_result_t
|
static isc_result_t
|
||||||
cfgkeylist_find(const cfg_obj_t *keylist, const char *keyname,
|
cfgkeylist_find(const cfg_obj_t *keylist, const char *keyname,
|
||||||
const cfg_obj_t **objp) {
|
const cfg_obj_t **objp) {
|
||||||
const cfg_listelt_t *element;
|
const cfg_listelt_t *element = NULL;
|
||||||
const char *str;
|
const char *str = NULL;
|
||||||
const cfg_obj_t *obj;
|
const cfg_obj_t *obj = NULL;
|
||||||
|
|
||||||
for (element = cfg_list_first(keylist); element != NULL;
|
for (element = cfg_list_first(keylist); element != NULL;
|
||||||
element = cfg_list_next(element))
|
element = cfg_list_next(element))
|
||||||
@@ -741,11 +741,11 @@ cfgkeylist_find(const cfg_obj_t *keylist, const char *keyname,
|
|||||||
static void
|
static void
|
||||||
controlkeylist_fromcfg(const cfg_obj_t *keylist, isc_mem_t *mctx,
|
controlkeylist_fromcfg(const cfg_obj_t *keylist, isc_mem_t *mctx,
|
||||||
controlkeylist_t *keyids) {
|
controlkeylist_t *keyids) {
|
||||||
const cfg_listelt_t *element;
|
const cfg_listelt_t *element = NULL;
|
||||||
char *newstr = NULL;
|
char *newstr = NULL;
|
||||||
const char *str;
|
const char *str = NULL;
|
||||||
const cfg_obj_t *obj;
|
const cfg_obj_t *obj = NULL;
|
||||||
controlkey_t *key;
|
controlkey_t *key = NULL;
|
||||||
|
|
||||||
for (element = cfg_list_first(keylist); element != NULL;
|
for (element = cfg_list_first(keylist); element != NULL;
|
||||||
element = cfg_list_next(element))
|
element = cfg_list_next(element))
|
||||||
@@ -767,8 +767,8 @@ controlkeylist_fromcfg(const cfg_obj_t *keylist, isc_mem_t *mctx,
|
|||||||
static void
|
static void
|
||||||
register_keys(const cfg_obj_t *control, const cfg_obj_t *keylist,
|
register_keys(const cfg_obj_t *control, const cfg_obj_t *keylist,
|
||||||
controlkeylist_t *keyids, isc_mem_t *mctx, const char *socktext) {
|
controlkeylist_t *keyids, isc_mem_t *mctx, const char *socktext) {
|
||||||
controlkey_t *keyid, *next;
|
controlkey_t *keyid = NULL, *next = NULL;
|
||||||
const cfg_obj_t *keydef;
|
const cfg_obj_t *keydef = NULL;
|
||||||
char secret[1024];
|
char secret[1024];
|
||||||
isc_buffer_t b;
|
isc_buffer_t b;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
@@ -801,10 +801,9 @@ register_keys(const cfg_obj_t *control, const cfg_obj_t *keylist,
|
|||||||
algstr = cfg_obj_asstring(algobj);
|
algstr = cfg_obj_asstring(algobj);
|
||||||
secretstr = cfg_obj_asstring(secretobj);
|
secretstr = cfg_obj_asstring(secretobj);
|
||||||
|
|
||||||
if (named_config_getkeyalgorithm2(algstr, NULL,
|
result = named_config_getkeyalgorithm2(algstr, NULL,
|
||||||
&algtype, NULL) !=
|
&algtype, NULL);
|
||||||
ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS) {
|
||||||
{
|
|
||||||
cfg_obj_log(control, named_g_lctx,
|
cfg_obj_log(control, named_g_lctx,
|
||||||
ISC_LOG_WARNING,
|
ISC_LOG_WARNING,
|
||||||
"unsupported algorithm '%s' in "
|
"unsupported algorithm '%s' in "
|
||||||
@@ -841,11 +840,12 @@ register_keys(const cfg_obj_t *control, const cfg_obj_t *keylist,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK(x) \
|
#define CHECK(x) \
|
||||||
do { \
|
do { \
|
||||||
result = (x); \
|
result = (x); \
|
||||||
if (result != ISC_R_SUCCESS) \
|
if (result != ISC_R_SUCCESS) { \
|
||||||
goto cleanup; \
|
goto cleanup; \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
@@ -895,9 +895,8 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) {
|
|||||||
algstr = cfg_obj_asstring(algobj);
|
algstr = cfg_obj_asstring(algobj);
|
||||||
secretstr = cfg_obj_asstring(secretobj);
|
secretstr = cfg_obj_asstring(secretobj);
|
||||||
|
|
||||||
if (named_config_getkeyalgorithm2(algstr, NULL, &algtype, NULL) !=
|
result = named_config_getkeyalgorithm2(algstr, NULL, &algtype, NULL);
|
||||||
ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS) {
|
||||||
{
|
|
||||||
cfg_obj_log(key, named_g_lctx, ISC_LOG_WARNING,
|
cfg_obj_log(key, named_g_lctx, ISC_LOG_WARNING,
|
||||||
"unsupported algorithm '%s' in "
|
"unsupported algorithm '%s' in "
|
||||||
"key '%s' for use with command "
|
"key '%s' for use with command "
|
||||||
@@ -970,8 +969,8 @@ update_listener(named_controls_t *cp, controllistener_t **listenerp,
|
|||||||
const cfg_obj_t *control, const cfg_obj_t *config,
|
const cfg_obj_t *control, const cfg_obj_t *config,
|
||||||
isc_sockaddr_t *addr, cfg_aclconfctx_t *aclconfctx,
|
isc_sockaddr_t *addr, cfg_aclconfctx_t *aclconfctx,
|
||||||
const char *socktext, isc_sockettype_t type) {
|
const char *socktext, isc_sockettype_t type) {
|
||||||
controllistener_t *listener;
|
controllistener_t *listener = NULL;
|
||||||
const cfg_obj_t *allow;
|
const cfg_obj_t *allow = NULL;
|
||||||
const cfg_obj_t *global_keylist = NULL;
|
const cfg_obj_t *global_keylist = NULL;
|
||||||
const cfg_obj_t *control_keylist = NULL;
|
const cfg_obj_t *control_keylist = NULL;
|
||||||
dns_acl_t *new_acl = NULL;
|
dns_acl_t *new_acl = NULL;
|
||||||
@@ -1064,7 +1063,7 @@ update_listener(named_controls_t *cp, controllistener_t **listenerp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (control != NULL) {
|
if (control != NULL) {
|
||||||
const cfg_obj_t *readonly;
|
const cfg_obj_t *readonly = NULL;
|
||||||
|
|
||||||
readonly = cfg_tuple_get(control, "read-only");
|
readonly = cfg_tuple_get(control, "read-only");
|
||||||
if (!cfg_obj_isvoid(readonly)) {
|
if (!cfg_obj_isvoid(readonly)) {
|
||||||
@@ -1123,35 +1122,25 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
|||||||
isc_sockaddr_t *addr, cfg_aclconfctx_t *aclconfctx,
|
isc_sockaddr_t *addr, cfg_aclconfctx_t *aclconfctx,
|
||||||
const char *socktext, isc_sockettype_t type) {
|
const char *socktext, isc_sockettype_t type) {
|
||||||
isc_mem_t *mctx = cp->server->mctx;
|
isc_mem_t *mctx = cp->server->mctx;
|
||||||
controllistener_t *listener;
|
controllistener_t *listener = NULL;
|
||||||
const cfg_obj_t *allow;
|
const cfg_obj_t *allow = NULL;
|
||||||
const cfg_obj_t *global_keylist = NULL;
|
const cfg_obj_t *global_keylist = NULL;
|
||||||
const cfg_obj_t *control_keylist = NULL;
|
const cfg_obj_t *control_keylist = NULL;
|
||||||
dns_acl_t *new_acl = NULL;
|
dns_acl_t *new_acl = NULL;
|
||||||
isc_result_t result = ISC_R_SUCCESS;
|
isc_result_t result = ISC_R_SUCCESS;
|
||||||
|
|
||||||
listener = isc_mem_get(mctx, sizeof(*listener));
|
listener = isc_mem_get(mctx, sizeof(*listener));
|
||||||
|
*listener = (controllistener_t){ .controls = cp,
|
||||||
listener->mctx = NULL;
|
.task = cp->server->task,
|
||||||
|
.address = *addr,
|
||||||
|
.type = type };
|
||||||
isc_mem_attach(mctx, &listener->mctx);
|
isc_mem_attach(mctx, &listener->mctx);
|
||||||
listener->controls = cp;
|
|
||||||
listener->task = cp->server->task;
|
|
||||||
listener->address = *addr;
|
|
||||||
listener->sock = NULL;
|
|
||||||
listener->listening = false;
|
|
||||||
listener->exiting = false;
|
|
||||||
listener->acl = NULL;
|
|
||||||
listener->type = type;
|
|
||||||
listener->perm = 0;
|
|
||||||
listener->owner = 0;
|
|
||||||
listener->group = 0;
|
|
||||||
listener->readonly = false;
|
|
||||||
ISC_LINK_INIT(listener, link);
|
ISC_LINK_INIT(listener, link);
|
||||||
ISC_LIST_INIT(listener->keys);
|
ISC_LIST_INIT(listener->keys);
|
||||||
ISC_LIST_INIT(listener->connections);
|
ISC_LIST_INIT(listener->connections);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make the acl.
|
* Make the ACL.
|
||||||
*/
|
*/
|
||||||
if (control != NULL && type == isc_sockettype_tcp) {
|
if (control != NULL && type == isc_sockettype_tcp) {
|
||||||
allow = cfg_tuple_get(control, "allow");
|
allow = cfg_tuple_get(control, "allow");
|
||||||
@@ -1161,8 +1150,8 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
|||||||
result = dns_acl_any(mctx, &new_acl);
|
result = dns_acl_any(mctx, &new_acl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((result == ISC_R_SUCCESS) && (control != NULL)) {
|
if (result == ISC_R_SUCCESS && control != NULL) {
|
||||||
const cfg_obj_t *readonly;
|
const cfg_obj_t *readonly = NULL;
|
||||||
|
|
||||||
readonly = cfg_tuple_get(control, "read-only");
|
readonly = cfg_tuple_get(control, "read-only");
|
||||||
if (!cfg_obj_isvoid(readonly)) {
|
if (!cfg_obj_isvoid(readonly)) {
|
||||||
@@ -1242,6 +1231,7 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
|||||||
result = isc_socket_permunix(&listener->address, listener->perm,
|
result = isc_socket_permunix(&listener->address, listener->perm,
|
||||||
listener->owner, listener->group);
|
listener->owner, listener->group);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
result = control_listen(listener);
|
result = control_listen(listener);
|
||||||
}
|
}
|
||||||
@@ -1279,7 +1269,7 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
|||||||
isc_result_t
|
isc_result_t
|
||||||
named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
|
named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
|
||||||
cfg_aclconfctx_t *aclconfctx) {
|
cfg_aclconfctx_t *aclconfctx) {
|
||||||
controllistener_t *listener;
|
controllistener_t *listener = NULL;
|
||||||
controllistenerlist_t new_listeners;
|
controllistenerlist_t new_listeners;
|
||||||
const cfg_obj_t *controlslist = NULL;
|
const cfg_obj_t *controlslist = NULL;
|
||||||
const cfg_listelt_t *element, *element2;
|
const cfg_listelt_t *element, *element2;
|
||||||
@@ -1304,7 +1294,7 @@ named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
|
|||||||
for (element = cfg_list_first(controlslist); element != NULL;
|
for (element = cfg_list_first(controlslist); element != NULL;
|
||||||
element = cfg_list_next(element))
|
element = cfg_list_next(element))
|
||||||
{
|
{
|
||||||
const cfg_obj_t *controls;
|
const cfg_obj_t *controls = NULL;
|
||||||
const cfg_obj_t *inetcontrols = NULL;
|
const cfg_obj_t *inetcontrols = NULL;
|
||||||
|
|
||||||
controls = cfg_listelt_value(element);
|
controls = cfg_listelt_value(element);
|
||||||
@@ -1317,8 +1307,8 @@ named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
|
|||||||
element2 != NULL;
|
element2 != NULL;
|
||||||
element2 = cfg_list_next(element2))
|
element2 = cfg_list_next(element2))
|
||||||
{
|
{
|
||||||
const cfg_obj_t *control;
|
const cfg_obj_t *control = NULL;
|
||||||
const cfg_obj_t *obj;
|
const cfg_obj_t *obj = NULL;
|
||||||
isc_sockaddr_t addr;
|
isc_sockaddr_t addr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1375,7 +1365,7 @@ named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
|
|||||||
for (element = cfg_list_first(controlslist); element != NULL;
|
for (element = cfg_list_first(controlslist); element != NULL;
|
||||||
element = cfg_list_next(element))
|
element = cfg_list_next(element))
|
||||||
{
|
{
|
||||||
const cfg_obj_t *controls;
|
const cfg_obj_t *controls = NULL;
|
||||||
const cfg_obj_t *unixcontrols = NULL;
|
const cfg_obj_t *unixcontrols = NULL;
|
||||||
|
|
||||||
controls = cfg_listelt_value(element);
|
controls = cfg_listelt_value(element);
|
||||||
@@ -1388,8 +1378,8 @@ named_controls_configure(named_controls_t *cp, const cfg_obj_t *config,
|
|||||||
element2 != NULL;
|
element2 != NULL;
|
||||||
element2 = cfg_list_next(element2))
|
element2 = cfg_list_next(element2))
|
||||||
{
|
{
|
||||||
const cfg_obj_t *control;
|
const cfg_obj_t *control = NULL;
|
||||||
const cfg_obj_t *path;
|
const cfg_obj_t *path = NULL;
|
||||||
isc_sockaddr_t addr;
|
isc_sockaddr_t addr;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
|
@@ -55,11 +55,11 @@
|
|||||||
|
|
||||||
#define SERVERADDRS 10
|
#define SERVERADDRS 10
|
||||||
|
|
||||||
const char *progname;
|
const char *progname = NULL;
|
||||||
bool verbose;
|
bool verbose;
|
||||||
|
|
||||||
static const char *admin_conffile;
|
static const char *admin_conffile = NULL;
|
||||||
static const char *admin_keyfile;
|
static const char *admin_keyfile = NULL;
|
||||||
static const char *version = PACKAGE_VERSION;
|
static const char *version = PACKAGE_VERSION;
|
||||||
static const char *servername = NULL;
|
static const char *servername = NULL;
|
||||||
static isc_sockaddr_t serveraddrs[SERVERADDRS];
|
static isc_sockaddr_t serveraddrs[SERVERADDRS];
|
||||||
@@ -69,18 +69,18 @@ static int nserveraddrs;
|
|||||||
static int currentaddr = 0;
|
static int currentaddr = 0;
|
||||||
static unsigned int remoteport = 0;
|
static unsigned int remoteport = 0;
|
||||||
static isc_socketmgr_t *socketmgr = NULL;
|
static isc_socketmgr_t *socketmgr = NULL;
|
||||||
static isc_buffer_t *databuf;
|
static isc_buffer_t *databuf = NULL;
|
||||||
static isccc_ccmsg_t ccmsg;
|
static isccc_ccmsg_t ccmsg;
|
||||||
static uint32_t algorithm;
|
static uint32_t algorithm;
|
||||||
static isccc_region_t secret;
|
static isccc_region_t secret;
|
||||||
static bool failed = false;
|
static bool failed = false;
|
||||||
static bool c_flag = false;
|
static bool c_flag = false;
|
||||||
static isc_mem_t *rndc_mctx;
|
static isc_mem_t *rndc_mctx = NULL;
|
||||||
static atomic_uint_fast32_t sends = ATOMIC_VAR_INIT(0);
|
static atomic_uint_fast32_t sends = ATOMIC_VAR_INIT(0);
|
||||||
static atomic_uint_fast32_t recvs = ATOMIC_VAR_INIT(0);
|
static atomic_uint_fast32_t recvs = ATOMIC_VAR_INIT(0);
|
||||||
static atomic_uint_fast32_t connects = ATOMIC_VAR_INIT(0);
|
static atomic_uint_fast32_t connects = ATOMIC_VAR_INIT(0);
|
||||||
static char *command;
|
static char *command = NULL;
|
||||||
static char *args;
|
static char *args = NULL;
|
||||||
static char program[256];
|
static char program[256];
|
||||||
static isc_socket_t *sock = NULL;
|
static isc_socket_t *sock = NULL;
|
||||||
static uint32_t serial;
|
static uint32_t serial;
|
||||||
@@ -114,7 +114,7 @@ command is one of the following:\n\
|
|||||||
Close, rename and re-open the DNSTAP output file(s).\n\
|
Close, rename and re-open the DNSTAP output file(s).\n\
|
||||||
dumpdb [-all|-cache|-zones|-adb|-bad|-fail] [view ...]\n\
|
dumpdb [-all|-cache|-zones|-adb|-bad|-fail] [view ...]\n\
|
||||||
Dump cache(s) to the dump file (named_dump.db).\n\
|
Dump cache(s) to the dump file (named_dump.db).\n\
|
||||||
flush Flushes all of the server's caches.\n\
|
flush Flushes all of the server's caches.\n\
|
||||||
flush [view] Flushes the server's cache for a view.\n\
|
flush [view] Flushes the server's cache for a view.\n\
|
||||||
flushname name [view]\n\
|
flushname name [view]\n\
|
||||||
Flush the given name from the server's cache(s)\n\
|
Flush the given name from the server's cache(s)\n\
|
||||||
@@ -652,7 +652,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
|
|||||||
if (servers != NULL) {
|
if (servers != NULL) {
|
||||||
for (elt = cfg_list_first(servers); elt != NULL;
|
for (elt = cfg_list_first(servers); elt != NULL;
|
||||||
elt = cfg_list_next(elt)) {
|
elt = cfg_list_next(elt)) {
|
||||||
const char *name;
|
const char *name = NULL;
|
||||||
server = cfg_listelt_value(elt);
|
server = cfg_listelt_value(elt);
|
||||||
name = cfg_obj_asstring(
|
name = cfg_obj_asstring(
|
||||||
cfg_map_getname(server));
|
cfg_map_getname(server));
|
||||||
@@ -689,9 +689,11 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
|
|||||||
DO("get config key list", cfg_map_get(config, "key", &keys));
|
DO("get config key list", cfg_map_get(config, "key", &keys));
|
||||||
for (elt = cfg_list_first(keys); elt != NULL;
|
for (elt = cfg_list_first(keys); elt != NULL;
|
||||||
elt = cfg_list_next(elt)) {
|
elt = cfg_list_next(elt)) {
|
||||||
|
const char *name = NULL;
|
||||||
|
|
||||||
key = cfg_listelt_value(elt);
|
key = cfg_listelt_value(elt);
|
||||||
if (strcasecmp(cfg_obj_asstring(cfg_map_getname(key)),
|
name = cfg_obj_asstring(cfg_map_getname(key));
|
||||||
keyname) == 0) {
|
if (strcasecmp(name, keyname) == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -990,7 +992,6 @@ main(int argc, char **argv) {
|
|||||||
DO("create task manager",
|
DO("create task manager",
|
||||||
isc_taskmgr_create(rndc_mctx, 1, 0, NULL, &taskmgr));
|
isc_taskmgr_create(rndc_mctx, 1, 0, NULL, &taskmgr));
|
||||||
DO("create task", isc_task_create(taskmgr, 0, &task));
|
DO("create task", isc_task_create(taskmgr, 0, &task));
|
||||||
|
|
||||||
isc_log_create(rndc_mctx, &log, &logconfig);
|
isc_log_create(rndc_mctx, &log, &logconfig);
|
||||||
isc_log_setcontext(log);
|
isc_log_setcontext(log);
|
||||||
isc_log_settag(logconfig, progname);
|
isc_log_settag(logconfig, progname);
|
||||||
|
@@ -46,7 +46,7 @@ recv_message(isc_task_t *, isc_event_t *);
|
|||||||
static void
|
static void
|
||||||
recv_length(isc_task_t *task, isc_event_t *ev_in) {
|
recv_length(isc_task_t *task, isc_event_t *ev_in) {
|
||||||
isc_socketevent_t *ev = (isc_socketevent_t *)ev_in;
|
isc_socketevent_t *ev = (isc_socketevent_t *)ev_in;
|
||||||
isc_event_t *dev;
|
isc_event_t *dev = NULL;
|
||||||
isccc_ccmsg_t *ccmsg = ev_in->ev_arg;
|
isccc_ccmsg_t *ccmsg = ev_in->ev_arg;
|
||||||
isc_region_t region;
|
isc_region_t region;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
@@ -101,10 +101,10 @@ send_and_free:
|
|||||||
static void
|
static void
|
||||||
recv_message(isc_task_t *task, isc_event_t *ev_in) {
|
recv_message(isc_task_t *task, isc_event_t *ev_in) {
|
||||||
isc_socketevent_t *ev = (isc_socketevent_t *)ev_in;
|
isc_socketevent_t *ev = (isc_socketevent_t *)ev_in;
|
||||||
isc_event_t *dev;
|
isc_event_t *dev = NULL;
|
||||||
isccc_ccmsg_t *ccmsg = ev_in->ev_arg;
|
isccc_ccmsg_t *ccmsg = ev_in->ev_arg;
|
||||||
|
|
||||||
(void)task;
|
UNUSED(task);
|
||||||
|
|
||||||
INSIST(VALID_CCMSG(ccmsg));
|
INSIST(VALID_CCMSG(ccmsg));
|
||||||
|
|
||||||
@@ -131,19 +131,17 @@ isccc_ccmsg_init(isc_mem_t *mctx, isc_socket_t *sock, isccc_ccmsg_t *ccmsg) {
|
|||||||
REQUIRE(sock != NULL);
|
REQUIRE(sock != NULL);
|
||||||
REQUIRE(ccmsg != NULL);
|
REQUIRE(ccmsg != NULL);
|
||||||
|
|
||||||
ccmsg->magic = CCMSG_MAGIC;
|
*ccmsg = (isccc_ccmsg_t){
|
||||||
ccmsg->size = 0;
|
.magic = CCMSG_MAGIC,
|
||||||
ccmsg->buffer.base = NULL;
|
.maxsize = 0xffffffffU, /* Largest message possible. */
|
||||||
ccmsg->buffer.length = 0;
|
.mctx = mctx,
|
||||||
ccmsg->maxsize = 4294967295U; /* Largest message possible. */
|
.sock = sock,
|
||||||
ccmsg->mctx = mctx;
|
.result = ISC_R_UNEXPECTED /* None yet. */
|
||||||
ccmsg->sock = sock;
|
};
|
||||||
ccmsg->task = NULL; /* None yet. */
|
|
||||||
ccmsg->result = ISC_R_UNEXPECTED; /* None yet. */
|
/*
|
||||||
/*
|
* Should probably initialize the event here, but it can wait.
|
||||||
* Should probably initialize the
|
*/
|
||||||
*event here, but it can wait.
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -197,21 +195,6 @@ isccc_ccmsg_cancelread(isccc_ccmsg_t *ccmsg) {
|
|||||||
isc_socket_cancel(ccmsg->sock, NULL, ISC_SOCKCANCEL_RECV);
|
isc_socket_cancel(ccmsg->sock, NULL, ISC_SOCKCANCEL_RECV);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
void
|
|
||||||
isccc_ccmsg_freebuffer(isccc_ccmsg_t*ccmsg) {
|
|
||||||
REQUIRE(VALID_CCMSG(ccmsg));
|
|
||||||
|
|
||||||
if (ccmsg->buffer.base == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
isc_mem_put(ccmsg->mctx,ccmsg->buffer.base,ccmsg->buffer.length);
|
|
||||||
ccmsg->buffer.base = NULL;
|
|
||||||
ccmsg->buffer.length = 0;
|
|
||||||
}
|
|
||||||
#endif /* if 0 */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg) {
|
isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg) {
|
||||||
REQUIRE(VALID_CCMSG(ccmsg));
|
REQUIRE(VALID_CCMSG(ccmsg));
|
||||||
|
Reference in New Issue
Block a user