From f4f67651db3891652f4dd08dec990aa0560bb35c Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Fri, 22 Apr 2016 17:39:30 +0200 Subject: irmd: reg/unreg whatevercast names Unregistering ap's now works. An AP now registers/unregisters its AP-I by sending its AP name and its pid to the IRMd. The IPCPs register whatevercast names. An AP name is currently mapped on a whatevercast name represented by the same string literal. The IRMd allows registration of only one AP-I per AP. A Name Space Management system is needed in the processing system so we can resolve this completely. Changing the stack to register whatevercast names required some changes all over the ipcpd implemented and in the library. --- src/ipcpd/shim-udp/main.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/ipcpd/shim-udp/main.c') diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index 14b08ba8..a65aa11d 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -214,8 +214,7 @@ static void * ipcp_udp_listener() msg.code = IRM_MSG_CODE__IPCP_FLOW_REQ_ARR; msg.ap_name = ANONYMOUS_AP; msg.ae_name = ""; /* no AE */ - msg.has_reg_ap_id = true; - msg.reg_ap_id = ipcp_data_get_reg_ap_id(_ipcp->data, buf); + msg.dst_name = buf; ret_msg = send_recv_irm_msg(&msg); if (ret_msg == NULL) { @@ -247,8 +246,9 @@ static void * ipcp_udp_listener() FD_SET(flow->fd, &shim_data(_ipcp)->flow_fd_s); shim_data(_ipcp)->fd_to_flow_ptr[flow->fd] = &flow->flow; - } + + return 0; } static void * ipcp_udp_sdu_reader() @@ -364,19 +364,19 @@ int ipcp_udp_bootstrap(struct dif_config * conf) return 0; } -int ipcp_udp_ap_reg(char * ap_name, uint32_t reg_ap_id) +int ipcp_udp_name_reg(char * name) { if (_ipcp->state != IPCP_ENROLLED) { LOG_DBGF("Won't register with non-enrolled IPCP."); return -1; } - if (ipcp_data_add_reg_entry(_ipcp->data, ap_name, reg_ap_id)) { - LOG_ERR("Failed to add AP to local registry."); + if (ipcp_data_add_reg_entry(_ipcp->data, name)) { + LOG_ERR("Failed to add %s to local registry.", name); return -1; } - LOG_DBG("Registered local ap %s, %u.", ap_name, reg_ap_id); + LOG_DBG("Registered %s", name); /* FIXME: register application with DNS server */ LOG_MISSING; @@ -384,9 +384,11 @@ int ipcp_udp_ap_reg(char * ap_name, uint32_t reg_ap_id) return 0; } -int ipcp_udp_ap_unreg(uint32_t reg_ap_id) +int ipcp_udp_name_unreg(char * name) { - ipcp_data_del_reg_entry(_ipcp->data, reg_ap_id); + ipcp_data_del_reg_entry(_ipcp->data, name); + + LOG_DBG("Unregistered %s.", name); /* FIXME: unregister application from DNS server */ LOG_MISSING; @@ -573,8 +575,8 @@ struct ipcp * ipcp_udp_create(char * ap_name, char * i_id) ops->ipcp_enroll = NULL; /* shim */ ops->ipcp_reg = NULL; /* shim */ ops->ipcp_unreg = NULL; /* shim */ - ops->ipcp_ap_reg = ipcp_udp_ap_reg; - ops->ipcp_ap_unreg = ipcp_udp_ap_unreg; + ops->ipcp_name_reg = ipcp_udp_name_reg; + ops->ipcp_name_unreg = ipcp_udp_name_unreg; ops->ipcp_flow_alloc = ipcp_udp_flow_alloc; ops->ipcp_flow_alloc_resp = ipcp_udp_flow_alloc_resp; ops->ipcp_flow_dealloc = ipcp_udp_flow_dealloc; -- cgit v1.2.3