diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/lib/cacep.c | 4 | ||||
-rw-r--r-- | src/lib/cacep.proto | 2 | ||||
-rw-r--r-- | src/lib/ipcp_config.proto | 28 | ||||
-rw-r--r-- | src/lib/ipcpd_messages.proto | 24 | ||||
-rw-r--r-- | src/lib/irm.c | 73 | ||||
-rw-r--r-- | src/lib/irmd_messages.proto | 2 |
7 files changed, 68 insertions, 69 deletions
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 2ee285f8..8e09c427 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -6,7 +6,7 @@ include_directories(${CMAKE_BINARY_DIR}/include) protobuf_generate_c(IRM_PROTO_SRCS IRM_PROTO_HDRS irmd_messages.proto) protobuf_generate_c(IPCP_PROTO_SRCS IPCP_PROTO_HDRS ipcpd_messages.proto) -protobuf_generate_c(DIF_CONFIG_PROTO_SRCS DIF_CONFIG_PROTO_HDRS +protobuf_generate_c(LAYER_CONFIG_PROTO_SRCS LAYER_CONFIG_PROTO_HDRS ipcp_config.proto) protobuf_generate_c(CACEP_PROTO_SRCS CACEP_PROTO_HDRS cacep.proto) @@ -217,7 +217,7 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY) add_library(ouroboros-common SHARED ${SOURCE_FILES_COMMON} ${IRM_PROTO_SRCS} - ${IPCP_PROTO_SRCS} ${DIF_CONFIG_PROTO_SRCS}) + ${IPCP_PROTO_SRCS} ${LAYER_CONFIG_PROTO_SRCS}) add_library(ouroboros-dev SHARED ${SOURCE_FILES_DEV} ${CACEP_PROTO_SRCS}) diff --git a/src/lib/cacep.c b/src/lib/cacep.c index fb1d4845..6efb7295 100644 --- a/src/lib/cacep.c +++ b/src/lib/cacep.c @@ -49,7 +49,7 @@ static int read_msg(int fd, if (msg == NULL) return -1; - strcpy(info->ae_name, msg->ae_name); + strcpy(info->comp_name, msg->comp_name); strcpy(info->protocol, msg->protocol); info->pref_version = msg->pref_version; @@ -68,7 +68,7 @@ static int send_msg(int fd, uint8_t * data = NULL; size_t len = 0; - msg.ae_name = (char *) info->ae_name; + msg.comp_name = (char *) info->comp_name; msg.protocol = (char *) info->protocol; msg.address = info->addr; msg.pref_version = info->pref_version; diff --git a/src/lib/cacep.proto b/src/lib/cacep.proto index 945ccccb..16c7a38a 100644 --- a/src/lib/cacep.proto +++ b/src/lib/cacep.proto @@ -28,7 +28,7 @@ message fixed_conc_syntax_msg { } message cacep_msg { - required string ae_name = 1; + required string comp_name = 1; required string protocol = 2; required int32 pref_version = 3; repeated int32 supp_version = 4; diff --git a/src/lib/ipcp_config.proto b/src/lib/ipcp_config.proto index 078c1491..92656f8d 100644 --- a/src/lib/ipcp_config.proto +++ b/src/lib/ipcp_config.proto @@ -1,7 +1,7 @@ /* * Ouroboros - Copyright (C) 2016 - 2018 * - * DIF config message + * Layer configuration message * * Dimitri Staessens <[email protected]> * Sander Vrijders <[email protected]> @@ -22,24 +22,24 @@ syntax = "proto2"; -message dif_info_msg { - required string dif_name = 1; +message layer_info_msg { + required string layer_name = 1; required uint32 dir_hash_algo = 2; } message ipcp_config_msg { - required dif_info_msg dif_info = 1; - required int32 ipcp_type = 2; + required layer_info_msg layer_info = 1; + required int32 ipcp_type = 2; // Config for normal IPCP - optional uint32 addr_size = 3; - optional uint32 fd_size = 4; - optional bool has_ttl = 5; - optional uint32 addr_auth_type = 6; - optional uint32 routing_type = 7; - optional uint32 pff_type = 8; + optional uint32 addr_size = 3; + optional uint32 eid_size = 4; + optional uint32 max_ttl = 5; + optional uint32 addr_auth_type = 6; + optional uint32 routing_type = 7; + optional uint32 pff_type = 8; // Config for UDP - optional uint32 ip_addr = 9; - optional uint32 dns_addr = 10; + optional uint32 ip_addr = 9; + optional uint32 dns_addr = 10; // Config for the Ethernet LLC - optional string if_name = 11; + optional string if_name = 11; } diff --git a/src/lib/ipcpd_messages.proto b/src/lib/ipcpd_messages.proto index af25189e..2d3bad7f 100644 --- a/src/lib/ipcpd_messages.proto +++ b/src/lib/ipcpd_messages.proto @@ -39,16 +39,16 @@ enum ipcp_msg_code { }; message ipcp_msg { - required ipcp_msg_code code = 1; - optional string name = 2; - optional bytes hash = 3; - optional int32 port_id = 4; - optional string dst_name = 5; - optional uint32 qoscube = 6; - optional ipcp_config_msg conf = 7; - optional int32 pid = 8; - optional dif_info_msg dif_info = 9; - optional int32 response = 10; - optional string comp_name = 11; - optional int32 result = 12; + required ipcp_msg_code code = 1; + optional string name = 2; + optional bytes hash = 3; + optional int32 port_id = 4; + optional string dst_name = 5; + optional uint32 qoscube = 6; + optional ipcp_config_msg conf = 7; + optional int32 pid = 8; + optional layer_info_msg layer_info = 9; + optional int32 response = 10; + optional string comp_name = 11; + optional int32 result = 12; }; diff --git a/src/lib/irm.c b/src/lib/irm.c index 8f5a5191..66b5c849 100644 --- a/src/lib/irm.c +++ b/src/lib/irm.c @@ -94,11 +94,11 @@ int irm_destroy_ipcp(pid_t pid) int irm_bootstrap_ipcp(pid_t pid, const struct ipcp_config * conf) { - irm_msg_t msg = IRM_MSG__INIT; - ipcp_config_msg_t config = IPCP_CONFIG_MSG__INIT; - dif_info_msg_t dif_info = DIF_INFO_MSG__INIT; - irm_msg_t * recv_msg = NULL; - int ret = -1; + irm_msg_t msg = IRM_MSG__INIT; + ipcp_config_msg_t config = IPCP_CONFIG_MSG__INIT; + layer_info_msg_t layer_info = LAYER_INFO_MSG__INIT; + irm_msg_t * recv_msg = NULL; + int ret = -1; if (pid == -1 || conf == NULL) return -EINVAL; @@ -107,10 +107,9 @@ int irm_bootstrap_ipcp(pid_t pid, msg.has_pid = true; msg.pid = pid; - config.dif_info = &dif_info; - msg.conf = &config; - - dif_info.dif_name = (char *) conf->dif_info.dif_name; + config.layer_info = &layer_info; + msg.conf = &config; + layer_info.layer_name = (char *) conf->layer_info.layer_name; config.ipcp_type = conf->type; @@ -118,17 +117,17 @@ int irm_bootstrap_ipcp(pid_t pid, case IPCP_NORMAL: config.has_addr_size = true; config.addr_size = conf->addr_size; - config.has_fd_size = true; - config.fd_size = conf->fd_size; - config.has_has_ttl = true; - config.has_ttl = conf->has_ttl; + config.has_eid_size = true; + config.eid_size = conf->eid_size; + config.has_max_ttl = true; + config.max_ttl = conf->max_ttl; config.has_addr_auth_type = true; config.addr_auth_type = conf->addr_auth_type; config.has_routing_type = true; config.routing_type = conf->routing_type; config.has_pff_type = true; config.pff_type = conf->pff_type; - dif_info.dir_hash_algo = conf->dif_info.dir_hash_algo; + layer_info.dir_hash_algo = conf->layer_info.dir_hash_algo; break; case IPCP_UDP: config.has_ip_addr = true; @@ -258,28 +257,28 @@ ssize_t irm_list_ipcps(const char * name, } int irm_enroll_ipcp(pid_t pid, - const char * dif_name) + const char * layer_name) { irm_msg_t msg = IRM_MSG__INIT; irm_msg_t * recv_msg = NULL; int ret = -1; - if (pid == -1 || dif_name == NULL) + if (pid == -1 || layer_name == NULL) return -EINVAL; - msg.code = IRM_MSG_CODE__IRM_ENROLL_IPCP; - msg.has_pid = true; - msg.pid = pid; - msg.n_dif_name = 1; - msg.dif_name = malloc(sizeof(*(msg.dif_name))); - if (msg.dif_name == NULL) + msg.code = IRM_MSG_CODE__IRM_ENROLL_IPCP; + msg.has_pid = true; + msg.pid = pid; + msg.n_layer_name = 1; + msg.layer_name = malloc(sizeof(*(msg.layer_name))); + if (msg.layer_name == NULL) return -ENOMEM; - msg.dif_name[0] = (char *) dif_name; + msg.layer_name[0] = (char *) layer_name; recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { - free(msg.dif_name); + free(msg.layer_name); return -EIRMD; } @@ -291,7 +290,7 @@ int irm_enroll_ipcp(pid_t pid, ret = recv_msg->result; irm_msg__free_unpacked(recv_msg, NULL); - free(msg.dif_name); + free(msg.layer_name); return ret; } @@ -519,22 +518,22 @@ int irm_unbind_process(pid_t pid, } int irm_reg(const char * name, - char ** difs, + char ** layers, size_t len) { - irm_msg_t msg = IRM_MSG__INIT; + irm_msg_t msg = IRM_MSG__INIT; irm_msg_t * recv_msg = NULL; - int ret = -1; + int ret = -1; - if (name == NULL || difs == NULL || len == 0) + if (name == NULL || layers == NULL || len == 0) return -EINVAL; msg.code = IRM_MSG_CODE__IRM_REG; msg.dst_name = (char *) name; - msg.dif_name = difs; - msg.n_dif_name = len; + msg.layer_name = layers; + msg.n_layer_name = len; recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) @@ -553,22 +552,22 @@ int irm_reg(const char * name, int irm_unreg(const char * name, - char ** difs, + char ** layers, size_t len) { - irm_msg_t msg = IRM_MSG__INIT; + irm_msg_t msg = IRM_MSG__INIT; irm_msg_t * recv_msg = NULL; - int ret = -1; + int ret = -1; - if (name == NULL || difs == NULL || len == 0) + if (name == NULL || layers == NULL || len == 0) return -EINVAL; msg.code = IRM_MSG_CODE__IRM_UNREG; msg.dst_name = (char *) name; - msg.dif_name = (char **) difs; - msg.n_dif_name = len; + msg.layer_name = (char **) layers; + msg.n_layer_name = len; recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) diff --git a/src/lib/irmd_messages.proto b/src/lib/irmd_messages.proto index b4b28136..51b15023 100644 --- a/src/lib/irmd_messages.proto +++ b/src/lib/irmd_messages.proto @@ -53,7 +53,7 @@ message irm_msg { optional string prog_name = 2; optional sint32 pid = 3; optional uint32 ipcp_type = 4; - repeated string dif_name = 5; + repeated string layer_name = 5; repeated string args = 6; optional sint32 response = 7; optional string dst_name = 8; |