diff options
author | Dimitri Staessens <dimitri.staessens@ugent.be> | 2018-03-22 11:02:15 +0100 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2018-03-22 12:36:58 +0100 |
commit | 751fb58bcf5fdb31c0627a5153684e96126cffb6 (patch) | |
tree | 5c4e8d8b2b2b323738703644c422a7e6c7095d5e /include | |
parent | fd5508b8daec47e9f646c086d4cc310583154b97 (diff) | |
download | ouroboros-751fb58bcf5fdb31c0627a5153684e96126cffb6.tar.gz ouroboros-751fb58bcf5fdb31c0627a5153684e96126cffb6.zip |
lib: Simplify reg/unreg API
The reg/unreg API is simplified to registering and unregistering a
single name with a single IPCP. The functionality associated with
registering names was moved from the IRMd to the irm tool. The
function to list IPCPs was simplified to return all IPCPs in the
system with their basic properties needed for management.
The above changes led to some needed changes in the irm tool and the
management functions that were depending on the previous behaviour of
list_ipcps.
Command line functionality to list IPCPs in the system is also added
to the irm tool.
Some older code was refactored.
Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/irm.h | 28 | ||||
-rw-r--r-- | include/ouroboros/sockets.h | 3 |
2 files changed, 19 insertions, 12 deletions
diff --git a/include/ouroboros/irm.h b/include/ouroboros/irm.h index ed0b2f71..fe6d2e9f 100644 --- a/include/ouroboros/irm.h +++ b/include/ouroboros/irm.h @@ -35,19 +35,27 @@ /* Name binding options. */ #define BIND_AUTO 0x01 +#define NAME_SIZE 256 +#define LAYER_SIZE LAYER_NAME_SIZE + +struct ipcp_info { + pid_t pid; + enum ipcp_type type; + char name[NAME_SIZE]; + char layer[LAYER_SIZE];; +}; + __BEGIN_DECLS pid_t irm_create_ipcp(const char * name, - enum ipcp_type ipcp_type); + enum ipcp_type type); int irm_destroy_ipcp(pid_t pid); -/* pids is an out-parameter */ -ssize_t irm_list_ipcps(const char * name, - pid_t ** pids); +ssize_t irm_list_ipcps(struct ipcp_info ** ipcps); int irm_enroll_ipcp(pid_t pid, - const char * layer_name); + const char * dst); int irm_bootstrap_ipcp(pid_t pid, const struct ipcp_config * conf); @@ -75,13 +83,11 @@ int irm_bind_process(pid_t pid, int irm_unbind_process(pid_t pid, const char * name); -int irm_reg(const char * name, - char ** layers, - size_t len); +int irm_reg(pid_t pid, + const char * name); -int irm_unreg(const char * name, - char ** layers, - size_t len); +int irm_unreg(pid_t pid, + const char * name); __END_DECLS diff --git a/include/ouroboros/sockets.h b/include/ouroboros/sockets.h index da3e36d0..36ea4da9 100644 --- a/include/ouroboros/sockets.h +++ b/include/ouroboros/sockets.h @@ -31,6 +31,7 @@ typedef LayerInfoMsg layer_info_msg_t; #include "irmd_messages.pb-c.h" typedef IrmMsg irm_msg_t; +typedef IpcpInfoMsg ipcp_info_msg_t; #include "ipcpd_messages.pb-c.h" typedef IpcpMsg ipcp_msg_t; @@ -39,7 +40,7 @@ typedef IpcpMsg ipcp_msg_t; #define SOCK_PATH_SUFFIX ".sock" #define IRM_SOCK_PATH SOCK_PATH "irm" SOCK_PATH_SUFFIX -#define IRM_MSG_BUF_SIZE 256 +#define IRM_MSG_BUF_SIZE 2048 #define IPCP_SOCK_PATH_PREFIX SOCK_PATH "ipcp" #define IPCP_MSG_BUF_SIZE IRM_MSG_BUF_SIZE |