diff options
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 | 6 | ||||
-rw-r--r-- | include/ouroboros/irm.h | 52 | ||||
-rw-r--r-- | include/ouroboros/irm_config.h | 73 |
5 files changed, 106 insertions, 121 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 <sander.vrijders@intec.ugent.be> - * Francesco Salvestrini <f.salvestrini@nextworks.it> - * - * 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..0c0afbe7 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,8 +32,7 @@ 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); 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 <sander.vrijders@intec.ugent.be> * @@ -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 <sander.vrijders@intec.ugent.be> + * + * 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 */ |