summaryrefslogtreecommitdiff
path: root/src/irmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/irmd')
-rw-r--r--src/irmd/ipcp.c20
-rw-r--r--src/irmd/ipcp.h8
-rw-r--r--src/irmd/main.c82
-rw-r--r--src/irmd/registry.c68
-rw-r--r--src/irmd/registry.h16
5 files changed, 97 insertions, 97 deletions
diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c
index 1b28c325..87cbaca5 100644
--- a/src/irmd/ipcp.c
+++ b/src/irmd/ipcp.c
@@ -205,7 +205,7 @@ int ipcp_destroy(pid_t pid)
int ipcp_bootstrap(pid_t pid,
ipcp_config_msg_t * conf,
- struct dif_info * info)
+ struct layer_info * info)
{
ipcp_msg_t msg = IPCP_MSG__INIT;
ipcp_msg_t * recv_msg = NULL;
@@ -232,13 +232,13 @@ int ipcp_bootstrap(pid_t pid,
return ret;
}
- if (recv_msg->dif_info == NULL) {
+ if (recv_msg->layer_info == NULL) {
ipcp_msg__free_unpacked(recv_msg, NULL);
return -EIPCP;
}
- info->dir_hash_algo = recv_msg->dif_info->dir_hash_algo;
- strcpy(info->dif_name, recv_msg->dif_info->dif_name);
+ info->dir_hash_algo = recv_msg->layer_info->dir_hash_algo;
+ strcpy(info->layer_name, recv_msg->layer_info->layer_name);
ret = recv_msg->result;
ipcp_msg__free_unpacked(recv_msg, NULL);
@@ -246,9 +246,9 @@ int ipcp_bootstrap(pid_t pid,
return ret;
}
-int ipcp_enroll(pid_t pid,
- const char * dst,
- struct dif_info * info)
+int ipcp_enroll(pid_t pid,
+ const char * dst,
+ struct layer_info * info)
{
ipcp_msg_t msg = IPCP_MSG__INIT;
ipcp_msg_t * recv_msg = NULL;
@@ -275,13 +275,13 @@ int ipcp_enroll(pid_t pid,
return ret;
}
- if (recv_msg->dif_info == NULL) {
+ if (recv_msg->layer_info == NULL) {
ipcp_msg__free_unpacked(recv_msg, NULL);
return -EIPCP;
}
- info->dir_hash_algo = recv_msg->dif_info->dir_hash_algo;
- strcpy(info->dif_name, recv_msg->dif_info->dif_name);
+ info->dir_hash_algo = recv_msg->layer_info->dir_hash_algo;
+ strcpy(info->layer_name, recv_msg->layer_info->layer_name);
ipcp_msg__free_unpacked(recv_msg, NULL);
diff --git a/src/irmd/ipcp.h b/src/irmd/ipcp.h
index 5a1c2fe4..8ff062b2 100644
--- a/src/irmd/ipcp.h
+++ b/src/irmd/ipcp.h
@@ -34,13 +34,13 @@ pid_t ipcp_create(const char * name,
int ipcp_destroy(pid_t pid);
-int ipcp_enroll(pid_t pid,
- const char * dst,
- struct dif_info * info);
+int ipcp_enroll(pid_t pid,
+ const char * dst,
+ struct layer_info * info);
int ipcp_bootstrap(pid_t pid,
ipcp_config_msg_t * conf,
- struct dif_info * info);
+ struct layer_info * info);
int ipcp_connect(pid_t pid,
const char * dst,
diff --git a/src/irmd/main.c b/src/irmd/main.c
index e9446ade..658811e2 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -82,7 +82,7 @@ struct ipcp_entry {
pid_t pid;
enum ipcp_type type;
enum hash_algo dir_hash_algo;
- char * dif_name;
+ char * layer_name;
enum init_state init_state;
pthread_cond_t init_cond;
@@ -202,8 +202,8 @@ static struct ipcp_entry * ipcp_entry_create(void)
if (e == NULL)
return NULL;
- e->name = NULL;
- e->dif_name = NULL;
+ e->name = NULL;
+ e->layer_name = NULL;
list_head_init(&e->next);
@@ -224,8 +224,8 @@ static void ipcp_entry_destroy(struct ipcp_entry * e)
if (e->name != NULL)
free(e->name);
- if (e->dif_name != NULL)
- free(e->dif_name);
+ if (e->layer_name != NULL)
+ free(e->layer_name);
free(e);
}
@@ -268,7 +268,7 @@ static struct ipcp_entry * get_ipcp_by_dst_name(const char * name,
list_for_each_safe(p, h, &irmd.ipcps) {
struct ipcp_entry * e = list_entry(p, struct ipcp_entry, next);
- if (e->dif_name == NULL || e->pid == src)
+ if (e->layer_name == NULL || e->pid == src)
continue;
hash = malloc(IPCP_HASH_LEN(e));
@@ -361,7 +361,7 @@ static pid_t create_ipcp(char * name,
pthread_mutex_init(&tmp->init_lock, NULL);
tmp->pid = ppid->pid;
- tmp->dif_name = NULL;
+ tmp->layer_name = NULL;
tmp->type = ipcp_type;
tmp->init_state = IPCP_BOOT;
tmp->dir_hash_algo = -1;
@@ -477,7 +477,7 @@ static int bootstrap_ipcp(pid_t pid,
ipcp_config_msg_t * conf)
{
struct ipcp_entry * entry = NULL;
- struct dif_info info;
+ struct layer_info info;
pthread_rwlock_wrlock(&irmd.reg_lock);
@@ -500,8 +500,8 @@ static int bootstrap_ipcp(pid_t pid,
return -1;
}
- entry->dif_name = strdup(info.dif_name);
- if (entry->dif_name == NULL) {
+ entry->layer_name = strdup(info.layer_name);
+ if (entry->layer_name == NULL) {
pthread_rwlock_unlock(&irmd.reg_lock);
log_warn("Failed to set name of layer.");
return -ENOMEM;
@@ -512,7 +512,7 @@ static int bootstrap_ipcp(pid_t pid,
pthread_rwlock_unlock(&irmd.reg_lock);
log_info("Bootstrapped IPCP %d in layer %s.",
- pid, conf->dif_info->dif_name);
+ pid, conf->layer_info->layer_name);
return 0;
}
@@ -521,7 +521,7 @@ static int enroll_ipcp(pid_t pid,
char * dst_name)
{
struct ipcp_entry * entry = NULL;
- struct dif_info info;
+ struct layer_info info;
pthread_rwlock_wrlock(&irmd.reg_lock);
@@ -532,7 +532,7 @@ static int enroll_ipcp(pid_t pid,
return -1;
}
- if (entry->dif_name != NULL) {
+ if (entry->layer_name != NULL) {
pthread_rwlock_unlock(&irmd.reg_lock);
log_err("IPCP in wrong state");
return -1;
@@ -554,10 +554,10 @@ static int enroll_ipcp(pid_t pid,
return -1;
}
- entry->dif_name = strdup(info.dif_name);
- if (entry->dif_name == NULL) {
+ entry->layer_name = strdup(info.layer_name);
+ if (entry->layer_name == NULL) {
pthread_rwlock_unlock(&irmd.reg_lock);
- log_err("Failed to strdup dif_name.");
+ log_err("Failed to strdup layer_name.");
return -ENOMEM;
}
@@ -566,7 +566,7 @@ static int enroll_ipcp(pid_t pid,
pthread_rwlock_unlock(&irmd.reg_lock);
log_info("Enrolled IPCP %d in layer %s.",
- pid, info.dif_name);
+ pid, info.layer_name);
return 0;
}
@@ -873,7 +873,7 @@ static ssize_t list_ipcps(char * name,
}
static int name_reg(const char * name,
- char ** difs,
+ char ** layers,
size_t len)
{
size_t i;
@@ -882,8 +882,8 @@ static int name_reg(const char * name,
assert(name);
assert(len);
- assert(difs);
- assert(difs[0]);
+ assert(layers);
+ assert(layers[0]);
pthread_rwlock_wrlock(&irmd.reg_lock);
@@ -929,7 +929,7 @@ static int name_reg(const char * name,
list_for_each(p, &irmd.ipcps) {
struct ipcp_entry * e = list_entry(p, struct ipcp_entry, next);
- if (e->dif_name == NULL)
+ if (e->layer_name == NULL)
continue;
for (i = 0; i < len; ++i) {
@@ -937,7 +937,7 @@ static int name_reg(const char * name,
pid_t pid;
size_t len;
- if (wildcard_match(difs[i], e->dif_name))
+ if (wildcard_match(layers[i], e->layer_name))
continue;
hash = malloc(IPCP_HASH_LEN(e));
@@ -962,15 +962,15 @@ static int name_reg(const char * name,
pthread_rwlock_wrlock(&irmd.reg_lock);
- if (registry_add_name_to_dif(&irmd.registry,
- name,
- e->dif_name,
- e->type) < 0)
+ if (registry_add_name_to_layer(&irmd.registry,
+ name,
+ e->layer_name,
+ e->type) < 0)
log_warn("Registered unbound name %s. "
"Registry may be corrupt.",
name);
log_info("Registered %s in %s as " HASH_FMT ".",
- name, e->dif_name, HASH_VAL(hash));
+ name, e->layer_name, HASH_VAL(hash));
++ret;
free(hash);
@@ -983,7 +983,7 @@ static int name_reg(const char * name,
}
static int name_unreg(const char * name,
- char ** difs,
+ char ** layers,
size_t len)
{
size_t i;
@@ -992,8 +992,8 @@ static int name_unreg(const char * name,
assert(name);
assert(len);
- assert(difs);
- assert(difs[0]);
+ assert(layers);
+ assert(layers[0]);
pthread_rwlock_wrlock(&irmd.reg_lock);
@@ -1001,7 +1001,7 @@ static int name_unreg(const char * name,
struct ipcp_entry * e =
list_entry(pos, struct ipcp_entry, next);
- if (e->dif_name == NULL)
+ if (e->layer_name == NULL)
continue;
for (i = 0; i < len; ++i) {
@@ -1009,7 +1009,7 @@ static int name_unreg(const char * name,
pid_t pid;
size_t len;
- if (wildcard_match(difs[i], e->dif_name))
+ if (wildcard_match(layers[i], e->layer_name))
continue;
hash = malloc(IPCP_HASH_LEN(e));
@@ -1033,11 +1033,11 @@ static int name_unreg(const char * name,
pthread_rwlock_wrlock(&irmd.reg_lock);
- registry_del_name_from_dif(&irmd.registry,
- name,
- e->dif_name);
+ registry_del_name_from_layer(&irmd.registry,
+ name,
+ e->layer_name);
log_info("Unregistered %s from %s.",
- name, e->dif_name);
+ name, e->layer_name);
++ret;
free(hash);
@@ -1952,7 +1952,7 @@ static void * mainloop(void * o)
case IRM_MSG_CODE__IRM_ENROLL_IPCP:
ret_msg.has_result = true;
ret_msg.result = enroll_ipcp(msg->pid,
- msg->dif_name[0]);
+ msg->layer_name[0]);
break;
case IRM_MSG_CODE__IRM_CONNECT_IPCP:
ret_msg.has_result = true;
@@ -2001,14 +2001,14 @@ static void * mainloop(void * o)
case IRM_MSG_CODE__IRM_REG:
ret_msg.has_result = true;
ret_msg.result = name_reg(msg->dst_name,
- msg->dif_name,
- msg->n_dif_name);
+ msg->layer_name,
+ msg->n_layer_name);
break;
case IRM_MSG_CODE__IRM_UNREG:
ret_msg.has_result = true;
ret_msg.result = name_unreg(msg->dst_name,
- msg->dif_name,
- msg->n_dif_name);
+ msg->layer_name,
+ msg->n_layer_name);
break;
case IRM_MSG_CODE__IRM_FLOW_ACCEPT:
ret_msg.has_result = true;
diff --git a/src/irmd/registry.c b/src/irmd/registry.c
index 32975b03..ace9f225 100644
--- a/src/irmd/registry.c
+++ b/src/irmd/registry.c
@@ -42,9 +42,9 @@
#include <limits.h>
#include <assert.h>
-struct reg_dif {
+struct reg_layer {
struct list_head next;
- char * dif_name;
+ char * layer_name;
enum ipcp_type type;
};
@@ -69,7 +69,7 @@ static int reg_entry_init(struct reg_entry * e,
return -1;
list_head_init(&e->next);
- list_head_init(&e->difs);
+ list_head_init(&e->layers);
list_head_init(&e->reg_progs);
list_head_init(&e->reg_pids);
@@ -121,10 +121,10 @@ static void cancel_reg_entry_destroy(void * o)
free(a);
}
- list_for_each_safe(p, h, &e->difs) {
- struct reg_dif * d = list_entry(p, struct reg_dif, next);
+ list_for_each_safe(p, h, &e->layers) {
+ struct reg_layer * d = list_entry(p, struct reg_layer, next);
list_del(&d->next);
- free(d->dif_name);
+ free(d->layer_name);
free(d);
}
@@ -158,57 +158,57 @@ static void reg_entry_destroy(struct reg_entry * e)
pthread_cleanup_pop(true);
}
-static bool reg_entry_is_local_in_dif(struct reg_entry * e,
- const char * dif_name)
+static bool reg_entry_is_local_in_layer(struct reg_entry * e,
+ const char * layer_name)
{
struct list_head * p = NULL;
- list_for_each(p, &e->difs) {
- struct reg_dif * d = list_entry(p, struct reg_dif, next);
- if (!strcmp(dif_name, d->dif_name))
+ list_for_each(p, &e->layers) {
+ struct reg_layer * d = list_entry(p, struct reg_layer, next);
+ if (!strcmp(layer_name, d->layer_name))
return true;
}
return false;
}
-static int reg_entry_add_local_in_dif(struct reg_entry * e,
- const char * dif_name,
- enum ipcp_type type)
+static int reg_entry_add_local_in_layer(struct reg_entry * e,
+ const char * layer_name,
+ enum ipcp_type type)
{
- struct reg_dif * rdn;
+ struct reg_layer * rdn;
/* already registered. Is ok */
- if (reg_entry_is_local_in_dif(e, dif_name))
+ if (reg_entry_is_local_in_layer(e, layer_name))
return 0;
rdn = malloc(sizeof(*rdn));
if (rdn == NULL)
return -1;
- rdn->dif_name = strdup(dif_name);
- if (rdn->dif_name == NULL) {
+ rdn->layer_name = strdup(layer_name);
+ if (rdn->layer_name == NULL) {
free(rdn);
return -1;
}
rdn->type = type;
- list_add(&rdn->next, &e->difs);
+ list_add(&rdn->next, &e->layers);
return 0;
}
-static void reg_entry_del_local_from_dif(struct reg_entry * e,
- const char * dif_name)
+static void reg_entry_del_local_from_layer(struct reg_entry * e,
+ const char * layer_name)
{
struct list_head * p = NULL;
struct list_head * h = NULL;
- list_for_each_safe(p, h, &e->difs) {
- struct reg_dif * d = list_entry(p, struct reg_dif, next);
- if (!strcmp(dif_name, d->dif_name)) {
+ list_for_each_safe(p, h, &e->layers) {
+ struct reg_layer * d = list_entry(p, struct reg_layer, next);
+ if (!strcmp(layer_name, d->layer_name)) {
list_del(&d->next);
- free(d->dif_name);
+ free(d->layer_name);
free(d);
}
}
@@ -637,27 +637,27 @@ void registry_del_process(struct list_head * registry,
return;
}
-int registry_add_name_to_dif(struct list_head * registry,
- const char * name,
- const char * dif_name,
- enum ipcp_type type)
+int registry_add_name_to_layer(struct list_head * registry,
+ const char * name,
+ const char * layer_name,
+ enum ipcp_type type)
{
struct reg_entry * re = registry_get_entry(registry, name);
if (re == NULL)
return -1;
- return reg_entry_add_local_in_dif(re, dif_name, type);
+ return reg_entry_add_local_in_layer(re, layer_name, type);
}
-void registry_del_name_from_dif(struct list_head * registry,
- const char * name,
- const char * dif_name)
+void registry_del_name_from_layer(struct list_head * registry,
+ const char * name,
+ const char * layer_name)
{
struct reg_entry * re = registry_get_entry(registry, name);
if (re == NULL)
return;
- reg_entry_del_local_from_dif(re, dif_name);
+ reg_entry_del_local_from_layer(re, layer_name);
}
void registry_destroy(struct list_head * registry)
diff --git a/src/irmd/registry.h b/src/irmd/registry.h
index e4e0f6c9..08fa9f28 100644
--- a/src/irmd/registry.h
+++ b/src/irmd/registry.h
@@ -56,7 +56,7 @@ struct reg_entry {
char * name;
/* layers in which this name is registered */
- struct list_head difs;
+ struct list_head layers;
/* Programs that can be instantiated by the irmd */
struct list_head reg_progs;
/* Processes that are listening for this name */
@@ -119,14 +119,14 @@ struct reg_entry * registry_get_entry_by_hash(struct list_head * registry,
const uint8_t * hash,
size_t len);
-int registry_add_name_to_dif(struct list_head * registry,
- const char * name,
- const char * dif_name,
- enum ipcp_type type);
-
-void registry_del_name_from_dif(struct list_head * registry,
+int registry_add_name_to_layer(struct list_head * registry,
const char * name,
- const char * dif_name);
+ const char * layer_name,
+ enum ipcp_type type);
+
+void registry_del_name_from_layer(struct list_head * registry,
+ const char * name,
+ const char * layer_name);
void registry_destroy(struct list_head * registry);