diff options
author | dimitri staessens <[email protected]> | 2016-04-22 17:39:30 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2016-04-22 17:39:30 +0200 |
commit | f4f67651db3891652f4dd08dec990aa0560bb35c (patch) | |
tree | 38d9d3f171389a85fc9b6ab7dcb640029ac0d743 /src/lib/dev.c | |
parent | cd428b2b63230fce191ff3a90d5f6928aa50df46 (diff) | |
download | ouroboros-f4f67651db3891652f4dd08dec990aa0560bb35c.tar.gz ouroboros-f4f67651db3891652f4dd08dec990aa0560bb35c.zip |
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.
Diffstat (limited to 'src/lib/dev.c')
-rw-r--r-- | src/lib/dev.c | 78 |
1 files changed, 46 insertions, 32 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c index c138b009..60dee701 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -43,9 +43,11 @@ int ap_reg(char * ap_name, return -EINVAL; } - msg.code = IRM_MSG_CODE__IRM_AP_REG; - msg.ap_name = ap_name; - msg.dif_name = difs; + msg.code = IRM_MSG_CODE__IRM_AP_REG; + msg.has_pid = true; + msg.pid = getpid(); + msg.ap_name = ap_name; + msg.dif_name = difs; msg.n_dif_name = difs_size; recv_msg = send_recv_irm_msg(&msg); @@ -78,9 +80,11 @@ int ap_unreg(char * ap_name, return -EINVAL; } - msg.code = IRM_MSG_CODE__IRM_AP_UNREG; - msg.ap_name = ap_name; - msg.dif_name = difs; + msg.code = IRM_MSG_CODE__IRM_AP_UNREG; + msg.has_pid = true; + msg.pid = getpid(); + msg.ap_name = ap_name; + msg.dif_name = difs; msg.n_dif_name = difs_size; recv_msg = send_recv_irm_msg(&msg); @@ -110,9 +114,11 @@ int flow_accept(int fd, return -EINVAL; } - msg.code = IRM_MSG_CODE__IRM_FLOW_ACCEPT; - msg.has_fd = true; - msg.fd = fd; + msg.code = IRM_MSG_CODE__IRM_FLOW_ACCEPT; + msg.has_pid = true; + msg.pid = getpid(); + msg.has_fd = true; + msg.fd = fd; recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) @@ -122,7 +128,7 @@ int flow_accept(int fd, irm_msg__free_unpacked(recv_msg, NULL); return -1; } - cli_fd = recv_msg->fd; + cli_fd = recv_msg->fd; ap_name = recv_msg->ap_name; ae_name = recv_msg->ae_name; @@ -131,17 +137,19 @@ int flow_accept(int fd, } int flow_alloc_resp(int fd, - int result) + int response) { irm_msg_t msg = IRM_MSG__INIT; irm_msg_t * recv_msg = NULL; int ret = -1; - msg.code = IRM_MSG_CODE__IRM_FLOW_ALLOC_RESP; - msg.has_fd = true; + msg.code = IRM_MSG_CODE__IRM_FLOW_ALLOC_RESP; + msg.has_pid = true; + msg.pid = getpid(); + msg.has_fd = true; msg.fd = fd; - msg.has_result = true; - msg.result = result; + msg.has_response = true; + msg.response = response; recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) @@ -158,7 +166,7 @@ int flow_alloc_resp(int fd, return ret; } -int flow_alloc(char * dst_ap_name, +int flow_alloc(char * dst_name, char * src_ap_name, char * src_ae_name, struct qos_spec * qos, @@ -168,18 +176,18 @@ int flow_alloc(char * dst_ap_name, irm_msg_t * recv_msg = NULL; int fd = 0; - if (dst_ap_name == NULL || + if (dst_name == NULL || src_ap_name == NULL || qos == NULL) { return -EINVAL; } - msg.code = IRM_MSG_CODE__IRM_FLOW_ALLOC; - msg.dst_ap_name = dst_ap_name; - msg.ap_name = src_ap_name; - msg.ae_name = src_ae_name; - msg.has_oflags = true; - msg.oflags = oflags; + msg.code = IRM_MSG_CODE__IRM_FLOW_ALLOC; + msg.dst_name = dst_name; + msg.ap_name = src_ap_name; + msg.ae_name = src_ae_name; + msg.has_oflags = true; + msg.oflags = oflags; recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) @@ -201,9 +209,11 @@ int flow_alloc_res(int fd) irm_msg_t * recv_msg = NULL; int result = 0; - msg.code = IRM_MSG_CODE__IRM_FLOW_ALLOC_RES; - msg.has_fd = true; - msg.fd = fd; + msg.code = IRM_MSG_CODE__IRM_FLOW_ALLOC_RES; + msg.has_pid = true; + msg.pid = getpid(); + msg.has_fd = true; + msg.fd = fd; recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) @@ -226,9 +236,11 @@ int flow_dealloc(int fd) irm_msg_t * recv_msg = NULL; int ret = -1; - msg.code = IRM_MSG_CODE__IRM_FLOW_DEALLOC; - msg.has_fd = true; - msg.fd = fd; + msg.code = IRM_MSG_CODE__IRM_FLOW_DEALLOC; + msg.has_pid = true; + msg.pid = getpid(); + msg.has_fd = true; + msg.fd = fd; recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) @@ -251,9 +263,11 @@ int flow_cntl(int fd, int oflags) irm_msg_t * recv_msg = NULL; int ret = -1; - msg.has_fd = true; - msg.fd = fd; - msg.oflags = oflags; + msg.has_pid = true; + msg.pid = getpid(); + msg.has_fd = true; + msg.fd = fd; + msg.oflags = oflags; recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) |