summaryrefslogtreecommitdiff
path: root/src/irmd/ipcp.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2016-10-26 09:56:31 +0000
committerdimitri staessens <[email protected]>2016-10-26 09:56:31 +0000
commitcc64e52dee3559128293a17a669e94acb48f9309 (patch)
treee4ef544c225e3b118c8a73d868dccaa073b55f11 /src/irmd/ipcp.c
parent0fd97235ecf670f1fc6db2723c530934b5376458 (diff)
parentf0646875d0bc941e339d305d0c68b13543cd6f2a (diff)
downloadouroboros-cc64e52dee3559128293a17a669e94acb48f9309.tar.gz
ouroboros-cc64e52dee3559128293a17a669e94acb48f9309.zip
Merged in sandervrijders/ouroboros/be-directory (pull request #280)
lib, irmd, ipcpd: Add name querying to IPCPs
Diffstat (limited to 'src/irmd/ipcp.c')
-rw-r--r--src/irmd/ipcp.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c
index 33f7650a..29327df4 100644
--- a/src/irmd/ipcp.c
+++ b/src/irmd/ipcp.c
@@ -20,15 +20,14 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#define OUROBOROS_PREFIX "irmd/ipcp"
+
#include <ouroboros/config.h>
+#include <ouroboros/logs.h>
#include <ouroboros/errno.h>
#include <ouroboros/utils.h>
#include <ouroboros/sockets.h>
-#define OUROBOROS_PREFIX "irmd/ipcp"
-
-#include <ouroboros/logs.h>
-
#include "ipcp.h"
#include <stdlib.h>
@@ -302,6 +301,31 @@ int ipcp_name_unreg(pid_t api,
return ret;
}
+int ipcp_name_query(pid_t api,
+ char * name)
+{
+ ipcp_msg_t msg = IPCP_MSG__INIT;
+ ipcp_msg_t * recv_msg = NULL;
+ int ret = -1;
+
+ msg.code = IPCP_MSG_CODE__IPCP_NAME_QUERY;
+ msg.name = name;
+
+ recv_msg = send_recv_ipcp_msg(api, &msg);
+ if (recv_msg == NULL)
+ return -1;
+
+ if (recv_msg->has_result == false) {
+ ipcp_msg__free_unpacked(recv_msg, NULL);
+ return -1;
+ }
+
+ ret = recv_msg->result;
+ ipcp_msg__free_unpacked(recv_msg, NULL);
+
+ return ret;
+}
+
int ipcp_flow_alloc(pid_t api,
int port_id,
pid_t n_api,