From 9903b8a2f9a7dc8ebac6928dcf2d2b5593ea0615 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Fri, 12 May 2017 13:05:47 +0200 Subject: ipcpd: Allow specifying fixed syntax This commits adds the functions and messages to specify a fixed protocol syntax during CACEP. It also revises the messages for specifying the DT protocol syntax from the irm tool. --- src/lib/cacep.proto | 20 ++++++++++++------- src/lib/ipcp_config.proto | 35 ++++++++++++++++----------------- src/lib/ipcpd_messages.proto | 23 +++++++++++----------- src/lib/irm.c | 47 +++++++++++++++++++------------------------- 4 files changed, 61 insertions(+), 64 deletions(-) (limited to 'src/lib') diff --git a/src/lib/cacep.proto b/src/lib/cacep.proto index cdeaa0b7..8a159a35 100644 --- a/src/lib/cacep.proto +++ b/src/lib/cacep.proto @@ -23,12 +23,18 @@ syntax = "proto2"; +message fixed_conc_syntax_msg { + repeated uint32 fids = 1; + repeated uint32 lens = 2; +} + message cacep_msg { - required string ae_name = 1; - required string protocol = 2; - required int32 pref_version = 3; - repeated int32 supp_version = 4; - required int32 pref_syntax = 5; - repeated int32 supp_syntax = 6; - required uint64 address = 7; + required string ae_name = 1; + required string protocol = 2; + required int32 pref_version = 3; + repeated int32 supp_version = 4; + required int32 pref_syntax = 5; + repeated int32 supp_syntax = 6; + optional fixed_conc_syntax_msg syntax_spec = 7; + required uint64 address = 8; } \ No newline at end of file diff --git a/src/lib/ipcp_config.proto b/src/lib/ipcp_config.proto index d5ff75d6..b6c8c303 100644 --- a/src/lib/ipcp_config.proto +++ b/src/lib/ipcp_config.proto @@ -23,25 +23,24 @@ syntax = "proto2"; +message dif_info_msg { + required string dif_name = 1; + required uint32 dir_hash_algo = 2; +} + message ipcp_config_msg { - required string dif_name = 1; - required uint32 dir_hash_algo = 2; - required int32 ipcp_type = 3; + required dif_info_msg dif_info = 1; + required int32 ipcp_type = 2; // Config for normal IPCP - optional uint32 addr_size = 4; - optional uint32 cep_id_size = 5; - optional uint32 pdu_length_size = 6; - optional uint32 seqno_size = 7; - optional bool has_ttl = 8; - optional bool has_chk = 9; - optional uint32 min_pdu_size = 10; - optional uint32 max_pdu_size = 11; - optional uint32 addr_auth_type = 12; - optional uint32 dt_gam_type = 13; - optional uint32 rm_gam_type = 14; + optional uint32 addr_size = 3; + optional uint32 fd_size = 4; + optional bool has_ttl = 5; + optional uint32 addr_auth_type = 6; + optional uint32 dt_gam_type = 7; + optional uint32 rm_gam_type = 8; // Config for shim UDP - optional uint32 ip_addr = 15; - optional uint32 dns_addr = 16; + optional uint32 ip_addr = 9; + optional uint32 dns_addr = 10; // Config for the shim Ethernet LLC - optional string if_name = 17; -} \ No newline at end of file + optional string if_name = 11; +} diff --git a/src/lib/ipcpd_messages.proto b/src/lib/ipcpd_messages.proto index 9299afcd..8a9ae214 100644 --- a/src/lib/ipcpd_messages.proto +++ b/src/lib/ipcpd_messages.proto @@ -38,16 +38,15 @@ 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 api = 8; - optional int32 dir_hash_algo = 9; - optional string dif_name = 10; - optional int32 response = 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 api = 8; + optional dif_info_msg dif_info = 9; + optional int32 response = 10; + optional int32 result = 11; }; diff --git a/src/lib/irm.c b/src/lib/irm.c index 12d8e8f7..d2f85bbf 100644 --- a/src/lib/irm.c +++ b/src/lib/irm.c @@ -93,6 +93,7 @@ int irm_bootstrap_ipcp(pid_t api, { 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; @@ -103,42 +104,34 @@ int irm_bootstrap_ipcp(pid_t api, msg.has_api = true; msg.api = api; + config.dif_info = &dif_info; msg.conf = &config; - config.dif_name = conf->dif_name; + + dif_info.dif_name = (char *) conf->dif_info.dif_name; + dif_info.dir_hash_algo = conf->dif_info.dir_hash_algo; + config.ipcp_type = conf->type; - config.dir_hash_algo = (enum hash_algo) conf->dir_hash_algo; switch (conf->type) { case IPCP_NORMAL: - config.has_addr_size = true; - config.has_cep_id_size = true; - config.has_pdu_length_size = true; - config.has_seqno_size = true; - config.has_has_ttl = true; - config.has_has_chk = true; - config.has_min_pdu_size = true; - config.has_max_pdu_size = true; + 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_addr_auth_type = true; - config.has_dt_gam_type = true; - config.has_rm_gam_type = true; - - config.addr_size = conf->addr_size; - config.cep_id_size = conf->cep_id_size; - config.pdu_length_size = conf->pdu_length_size; - config.seqno_size = conf->seqno_size; - config.has_ttl = conf->has_ttl; - config.has_chk = conf->has_chk; - config.min_pdu_size = conf->min_pdu_size; - config.max_pdu_size = conf->max_pdu_size; - config.addr_auth_type = conf->addr_auth_type; - config.dt_gam_type = conf->dt_gam_type; - config.rm_gam_type = conf->rm_gam_type; + config.addr_auth_type = conf->addr_auth_type; + config.has_dt_gam_type = true; + config.dt_gam_type = conf->dt_gam_type; + config.has_rm_gam_type = true; + config.rm_gam_type = conf->rm_gam_type; break; case IPCP_SHIM_UDP: - config.has_ip_addr = true; - config.ip_addr = conf->ip_addr; + config.has_ip_addr = true; + config.ip_addr = conf->ip_addr; config.has_dns_addr = true; - config.dns_addr = conf->dns_addr; + config.dns_addr = conf->dns_addr; break; case IPCP_LOCAL: break; -- cgit v1.2.3