summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/enroll.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2017-02-08 17:09:55 +0100
committerdimitri staessens <[email protected]>2017-02-08 18:04:13 +0100
commit742d01a4f9a32f17561104ee7da8971c1bcdd703 (patch)
tree26a9c0b622b5bf875b783692837d1069799f8fcc /src/ipcpd/normal/enroll.c
parent9117f7f6fec70f2da24e8e77256747d11d67bf8d (diff)
downloadouroboros-742d01a4f9a32f17561104ee7da8971c1bcdd703.tar.gz
ouroboros-742d01a4f9a32f17561104ee7da8971c1bcdd703.zip
lib: Log to the logging system
This removes the logfile and outputs log messages to the logging system. The creation of the logfiles (as well as the ap_init() call) were moved into ipcp_init() to simplify the IPCP creation and shutdown. Fixes #25 Fixes #27
Diffstat (limited to 'src/ipcpd/normal/enroll.c')
-rw-r--r--src/ipcpd/normal/enroll.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c
index 695ceb1d..fb4ff3c3 100644
--- a/src/ipcpd/normal/enroll.c
+++ b/src/ipcpd/normal/enroll.c
@@ -58,14 +58,14 @@ int enroll_handle(int fd)
if (flow_alloc_resp(fd, 0) < 0) {
flow_dealloc(fd);
- LOG_ERR("Could not respond to request.");
+ log_err("Could not respond to request.");
return -1;
}
ci = cdap_create(fd);
if (ci == NULL) {
flow_dealloc(fd);
- LOG_ERR("Failed to create CDAP instance.");
+ log_err("Failed to create CDAP instance.");
return -1;
}
@@ -78,11 +78,11 @@ int enroll_handle(int fd)
if (data != NULL) {
free(data);
- LOG_WARN("Received data with enrollment request.");
+ log_warn("Received data with enrollment request.");
}
if (oc != CDAP_READ) {
- LOG_WARN("Invalid request.");
+ log_warn("Invalid request.");
cdap_reply_send(ci, key, -1, NULL, 0);
cdap_destroy(ci);
flow_dealloc(fd);
@@ -97,7 +97,7 @@ int enroll_handle(int fd)
} else if (strcmp(name, dif_ro) == 0) {
dif_name_r = true;
} else {
- LOG_WARN("Illegal read: %s.", name);
+ log_warn("Illegal read: %s.", name);
cdap_reply_send(ci, key, -1, NULL, 0);
cdap_destroy(ci);
flow_dealloc(fd);
@@ -107,7 +107,7 @@ int enroll_handle(int fd)
len = rib_pack(name, &buf, PACK_HASH_ROOT);
if (len < 0) {
- LOG_ERR("Failed to pack %s.", name);
+ log_err("Failed to pack %s.", name);
cdap_reply_send(ci, key, -1, NULL, 0);
cdap_destroy(ci);
flow_dealloc(fd);
@@ -115,12 +115,12 @@ int enroll_handle(int fd)
return -1;
}
- LOG_DBG("Packed %s (%lu bytes).", name, len);
+ log_dbg("Packed %s (%lu bytes).", name, len);
free(name);
if (cdap_reply_send(ci, key, 0, buf, len)) {
- LOG_ERR("Failed to send CDAP reply.");
+ log_err("Failed to send CDAP reply.");
cdap_destroy(ci);
flow_dealloc(fd);
return -1;
@@ -129,7 +129,7 @@ int enroll_handle(int fd)
free(buf);
}
- LOG_DBG("Sent boot info to new member.");
+ log_dbg("Sent boot info to new member.");
cdap_destroy(ci);
@@ -152,44 +152,44 @@ int enroll_boot(char * dst_name)
fd = flow_alloc(dst_name, ENROLL_AE, NULL);
if (fd < 0) {
- LOG_ERR("Failed to allocate flow.");
+ log_err("Failed to allocate flow.");
return -1;
}
if (flow_alloc_res(fd)) {
- LOG_ERR("Flow allocation failed.");
+ log_err("Flow allocation failed.");
flow_dealloc(fd);
return -1;
}
ci = cdap_create(fd);
if (ci == NULL) {
- LOG_ERR("Failed to create CDAP instance.");
+ log_err("Failed to create CDAP instance.");
flow_dealloc(fd);
return -1;
}
- LOG_DBG("Getting boot information from %s.", dst_name);
+ log_dbg("Getting boot information from %s.", dst_name);
key = cdap_request_send(ci, CDAP_READ, boot_ro, NULL, 0, 0);
if (key < 0) {
- LOG_ERR("Failed to send CDAP request.");
+ log_err("Failed to send CDAP request.");
cdap_destroy(ci);
flow_dealloc(fd);
return -1;
}
if (cdap_reply_wait(ci, key, &data, &len)) {
- LOG_ERR("Failed to get CDAP reply.");
+ log_err("Failed to get CDAP reply.");
cdap_destroy(ci);
flow_dealloc(fd);
return -1;
}
- LOG_DBG("Packed information received (%lu bytes).", len);
+ log_dbg("Packed information received (%lu bytes).", len);
if (rib_unpack(data, len, UNPACK_CREATE)) {
- LOG_WARN("Error unpacking RIB data.");
+ log_warn("Error unpacking RIB data.");
rib_del(boot_ro);
free(data);
cdap_destroy(ci);
@@ -197,27 +197,27 @@ int enroll_boot(char * dst_name)
return -1;
}
- LOG_DBG("Packed information inserted into RIB.");
+ log_dbg("Packed information inserted into RIB.");
key = cdap_request_send(ci, CDAP_READ, members_ro, NULL, 0, 0);
if (key < 0) {
- LOG_ERR("Failed to send CDAP request.");
+ log_err("Failed to send CDAP request.");
cdap_destroy(ci);
flow_dealloc(fd);
return -1;
}
if (cdap_reply_wait(ci, key, &data, &len)) {
- LOG_ERR("Failed to get CDAP reply.");
+ log_err("Failed to get CDAP reply.");
cdap_destroy(ci);
flow_dealloc(fd);
return -1;
}
- LOG_DBG("Packed information received (%lu bytes).", len);
+ log_dbg("Packed information received (%lu bytes).", len);
if (rib_unpack(data, len, UNPACK_CREATE)) {
- LOG_WARN("Error unpacking RIB data.");
+ log_warn("Error unpacking RIB data.");
rib_del(boot_ro);
free(data);
cdap_destroy(ci);
@@ -225,27 +225,27 @@ int enroll_boot(char * dst_name)
return -1;
}
- LOG_DBG("Packed information inserted into RIB.");
+ log_dbg("Packed information inserted into RIB.");
key = cdap_request_send(ci, CDAP_READ, dif_ro, NULL, 0, 0);
if (key < 0) {
- LOG_ERR("Failed to send CDAP request.");
+ log_err("Failed to send CDAP request.");
cdap_destroy(ci);
flow_dealloc(fd);
return -1;
}
if (cdap_reply_wait(ci, key, &data, &len)) {
- LOG_ERR("Failed to get CDAP reply.");
+ log_err("Failed to get CDAP reply.");
cdap_destroy(ci);
flow_dealloc(fd);
return -1;
}
- LOG_DBG("Packed information received (%lu bytes).", len);
+ log_dbg("Packed information received (%lu bytes).", len);
if (rib_unpack(data, len, UNPACK_CREATE)) {
- LOG_WARN("Error unpacking RIB data.");
+ log_warn("Error unpacking RIB data.");
rib_del(boot_ro);
free(data);
cdap_destroy(ci);
@@ -253,7 +253,7 @@ int enroll_boot(char * dst_name)
return -1;
}
- LOG_DBG("Packed information inserted into RIB.");
+ log_dbg("Packed information inserted into RIB.");
cdap_destroy(ci);