diff options
author | dimitri staessens <[email protected]> | 2016-06-28 17:02:42 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2016-06-28 17:02:42 +0200 |
commit | a19521aa74edfa4a2eb62466b04c9264c3b6576c (patch) | |
tree | 36b94730d8690c2d131f39b3cc3ff715674f9fcc /include | |
parent | acd29da104d0d8ddace2b2693314542bb5a56fcc (diff) | |
parent | 99d19307fae8f1370f52a62aee88fded624ad464 (diff) | |
download | ouroboros-a19521aa74edfa4a2eb62466b04c9264c3b6576c.tar.gz ouroboros-a19521aa74edfa4a2eb62466b04c9264c3b6576c.zip |
Merged in sandervrijders/ouroboros/be (pull request #144)
lib, irmd, ipcpd: Change of IRM API
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/CMakeLists.txt | 5 | ||||
-rw-r--r-- | include/ouroboros/instance_name.h | 91 | ||||
-rw-r--r-- | include/ouroboros/ipcp.h | 36 | ||||
-rw-r--r-- | include/ouroboros/irm.h | 52 | ||||
-rw-r--r-- | include/ouroboros/irm_config.h | 73 | ||||
-rw-r--r-- | include/ouroboros/sockets.h | 2 |
6 files changed, 122 insertions, 137 deletions
diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt index 2ea86883..68c88a18 100644 --- a/include/ouroboros/CMakeLists.txt +++ b/include/ouroboros/CMakeLists.txt @@ -5,13 +5,12 @@ configure_file( set(HEADER_FILES cdap.h dev.h - dif_config.h errno.h flow.h - instance_name.h irm.h + irm_config.h nsm.h qos.h ) -install(FILES ${HEADER_FILES} DESTINATION /usr/include/ouroboros) +install(FILES ${HEADER_FILES} DESTINATION usr/include/ouroboros) diff --git a/include/ouroboros/instance_name.h b/include/ouroboros/instance_name.h deleted file mode 100644 index 92681504..00000000 --- a/include/ouroboros/instance_name.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * RINA naming related utilities - * - * Sander Vrijders <[email protected]> - * Francesco Salvestrini <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef INSTANCE_NAME_H -#define INSTANCE_NAME_H - -#include <stdint.h> -#include <unistd.h> -#include <stdbool.h> - -typedef struct { - char * name; - uint16_t id; -} instance_name_t; - -/* - * Allocates a new name, returning the allocated object. - * In case of an error, a NULL is returned. - */ -instance_name_t * instance_name_create(); - -/* - * Initializes a previously dynamically allocated name (i.e. name_create()) - * or a statically one (e.g. declared into a struct not as a pointer). - * Returns the passed object pointer in case everything is ok, a NULL - * otherwise. - * - * A call to name_destroy() is allowed in case of error, in order to - * release the associated resources. - * - * It is allowed to call name_init() over an already initialized object - */ -instance_name_t * instance_name_init_from(instance_name_t * dst, - const char * name, - uint16_t api_id); - -/* Takes ownership of the passed parameters */ -instance_name_t * instance_name_init_with(instance_name_t * dst, - char * name, - uint16_t id); - -/* - * Finalize a name object, releasing all the embedded resources (without - * releasing the object itself). After name_fini() execution the passed - * object will be in the same states as at the end of name_init(). - */ -void instance_name_fini(instance_name_t * dst); - -/* Releases all the associated resources bound to a name object */ -void instance_name_destroy(instance_name_t * ptr); - -/* Duplicates a name object, returning the pointer to the new object */ -instance_name_t * instance_name_dup(const instance_name_t * src); - -/* - * Copies the source object contents into the destination object, both must - * be previously allocated - */ -int instance_name_cpy(instance_name_t * dst, - const instance_name_t * src); - -int instance_name_cmp(const instance_name_t * a, - const instance_name_t * b); - -bool instance_name_is_valid(const instance_name_t * n); - -/* Returns a name as a (newly allocated) string */ -char * instance_name_to_string(const instance_name_t * n); - -/* Inverse of name_tostring() */ -instance_name_t * string_to_instance_name(const char * s); - -#endif /* INSTANCE_NAME_H */ diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h index 0d62bd59..f5657b64 100644 --- a/include/ouroboros/ipcp.h +++ b/include/ouroboros/ipcp.h @@ -20,8 +20,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <ouroboros/dif_config.h> -#include <ouroboros/instance_name.h> +#include <ouroboros/irm_config.h> #include <ouroboros/sockets.h> #include <ouroboros/common.h> @@ -33,58 +32,57 @@ struct ipcp; /* Returns the process id */ -pid_t ipcp_create(char * ipcp_name, - enum ipcp_type ipcp_type); +pid_t ipcp_create(enum ipcp_type ipcp_type); -int ipcp_destroy(pid_t pid); +int ipcp_destroy(pid_t api); -int ipcp_reg(pid_t pid, +int ipcp_reg(pid_t api, char ** difs, size_t difs_size); -int ipcp_unreg(pid_t pid, +int ipcp_unreg(pid_t api, char ** difs, size_t difs_size); -int ipcp_enroll(pid_t pid, +int ipcp_enroll(pid_t api, char * dif_name, char * n_1_dif); -int ipcp_bootstrap(pid_t pid, +int ipcp_bootstrap(pid_t api, dif_config_msg_t * conf); /* Flow related ops, these go from IRMd to IPCP */ -int ipcp_name_reg(pid_t pid, +int ipcp_name_reg(pid_t api, char * name); -int ipcp_name_unreg(pid_t pid, +int ipcp_name_unreg(pid_t api, char * name); -int ipcp_flow_alloc(pid_t pid, +int ipcp_flow_alloc(pid_t api, int port_id, - pid_t n_pid, + pid_t n_api, char * dst_name, char * src_ae_name, enum qos_cube qos); -int ipcp_flow_alloc_resp(pid_t pid, +int ipcp_flow_alloc_resp(pid_t api, int port_id, - pid_t n_pid, + pid_t n_api, int response); /* These operations go from the IPCP to the IRMd */ /* Returns the port_id */ -int ipcp_flow_req_arr(pid_t pid, +int ipcp_flow_req_arr(pid_t api, char * dst_name, char * src_ae_name); -int ipcp_flow_alloc_reply(pid_t pid, +int ipcp_flow_alloc_reply(pid_t api, int port_id, int response); /* * This operation can go both ways - * pid == 0 means the IRMd is the destination + * api == 0 means the IRMd is the destination */ -int ipcp_flow_dealloc(pid_t pid, +int ipcp_flow_dealloc(pid_t api, int port_id); diff --git a/include/ouroboros/irm.h b/include/ouroboros/irm.h index 743ed79c..9f27db05 100644 --- a/include/ouroboros/irm.h +++ b/include/ouroboros/irm.h @@ -1,7 +1,7 @@ /* * Ouroboros - Copyright (C) 2016 * - * The API to instruct the IRM + * The API to instruct the IPC Resource Manager * * Sander Vrijders <[email protected]> * @@ -23,34 +23,40 @@ #ifndef OUROBOROS_IRM_H #define OUROBOROS_IRM_H -#include <ouroboros/instance_name.h> -#include <ouroboros/dif_config.h> - +#include <ouroboros/irm_config.h> #include <sys/types.h> -pid_t irm_create_ipcp(char * ipcp_name, - enum ipcp_type ipcp_type); +pid_t irm_create_ipcp(char * name, + enum ipcp_type ipcp_type); + +int irm_destroy_ipcp(pid_t api); + +/* APIs is an out-parameter */ +ssize_t irm_list_ipcps(char * name, + pid_t ** apis); + +int irm_enroll_ipcp(pid_t api, + char * dif_name); -int irm_destroy_ipcp(instance_name_t * api); +int irm_bootstrap_ipcp(pid_t api, + struct dif_config * conf); -int irm_enroll_ipcp(instance_name_t * api, - char * dif_name); +int irm_bind(char * name, + char * ap_name, + uint16_t opts, + int argc, + char ** argv); -int irm_bootstrap_ipcp(instance_name_t * api, - struct dif_config * conf); +int irm_unbind(char * name, + char * ap_name, + uint16_t opts); -int irm_reg(char * name, - instance_name_t * api, - int argc, - char ** argv, - bool autoexec, - char ** difs, - size_t difs_size); +int irm_reg(char * name, + char ** difs, + size_t difs_size); -int irm_unreg(char * name, - const instance_name_t * api, - char ** difs, - size_t difs_size, - bool hard); +int irm_unreg(char * name, + char ** difs, + size_t difs_size); #endif /* OUROBOROS_IRM_H */ diff --git a/include/ouroboros/irm_config.h b/include/ouroboros/irm_config.h new file mode 100644 index 00000000..d5f2b565 --- /dev/null +++ b/include/ouroboros/irm_config.h @@ -0,0 +1,73 @@ +/* + * Ouroboros - Copyright (C) 2016 + * + * Configuration information for the IPC Resource Manager + * + * Sander Vrijders <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdint.h> +#include <unistd.h> + +#ifndef OUROBOROS_IRM_CONFIG_H +#define OUROBOROS_IRM_CONFIG_H + +/* Name binding options */ + +#define BIND_AP_AUTO 0x01 +#define BIND_AP_UNIQUE 0x02 + +enum ipcp_type { + IPCP_NORMAL = 0, + IPCP_LOCAL, + IPCP_SHIM_UDP, + IPCP_SHIM_ETH_LLC +}; + +struct dif_config { + char * dif_name; + enum ipcp_type type; + + union { + /* Normal DIF */ + struct { + uint8_t addr_size; + uint8_t cep_id_size; + uint8_t pdu_length_size; + uint8_t qos_id_size; + uint8_t seqno_size; + + /* DUP constants */ + uint8_t ttl_size; + uint8_t chk_size; + + uint32_t min_pdu_size; + uint32_t max_pdu_size; + }; + /* Shim UDP */ + struct { + uint32_t ip_addr; + uint32_t dns_addr; + }; + /* Shim Ethernet LLC */ + struct { + char * if_name; + }; + }; +}; + +#endif /* OUROBOROS_IRM_CONFIG_H */ diff --git a/include/ouroboros/sockets.h b/include/ouroboros/sockets.h index 0a215a76..ce7876b3 100644 --- a/include/ouroboros/sockets.h +++ b/include/ouroboros/sockets.h @@ -46,7 +46,7 @@ typedef IpcpMsg ipcp_msg_t; #define IPCP_MSG_BUF_SIZE IRM_MSG_BUF_SIZE /* Returns the full socket path of an IPCP */ -char * ipcp_sock_path(pid_t pid); +char * ipcp_sock_path(pid_t api); int server_socket_open(char * file_name); int client_socket_open(char * file_name); |