diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2023-11-27 14:43:11 +0100 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2023-11-29 09:57:29 +0100 |
commit | 346b054ee32a9f7b8491f842709f72cc8d1f3f2e (patch) | |
tree | 5a406924ca94a03460e9b1e14d50cd1fca7c5c61 /src/lib/irm.c | |
parent | 3f24301fff9c544dfe2b89c5737bc3cdf94ef9a9 (diff) | |
download | ouroboros-346b054ee32a9f7b8491f842709f72cc8d1f3f2e.tar.gz ouroboros-346b054ee32a9f7b8491f842709f72cc8d1f3f2e.zip |
include: Store IPCP name and type in info struct
The information for an IPCP is now stored in an ipcp_info struct,
containing name and type. The IRM public API is not changed.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib/irm.c')
-rw-r--r-- | src/lib/irm.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/irm.c b/src/lib/irm.c index 4c744e8a..ce646ae7 100644 --- a/src/lib/irm.c +++ b/src/lib/irm.c @@ -41,17 +41,19 @@ pid_t irm_create_ipcp(const char * name, enum ipcp_type type) { - irm_msg_t msg = IRM_MSG__INIT; - irm_msg_t * recv_msg = NULL; - int ret = -1; + irm_msg_t msg = IRM_MSG__INIT; + irm_msg_t * recv_msg; + int ret; + struct ipcp_info info; - if (name == NULL) + if (name == NULL || strlen(name) > IPCP_NAME_SIZE) return -EINVAL; - msg.code = IRM_MSG_CODE__IRM_CREATE_IPCP; - msg.name = (char *) name; - msg.has_ipcp_type = true; - msg.ipcp_type = type; + info.type = type; + strcpy(info.name, name); + + msg.code = IRM_MSG_CODE__IRM_CREATE_IPCP; + msg.ipcp_info = ipcp_info_s_to_msg(&info); recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) |