From 45c6615484ffe347654c34decb72ff1ef9bde0f3 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Sat, 9 Sep 2017 13:50:47 +0200 Subject: ipcpd: Revise internals of normal IPCP This removes the RIB as a datastructure and CDAP as the protocol between IPCPs. CDAP, the rib and related sources are deprecated. The link-state protocol policy is udpated to use its own protocol based on a simple broadcast strategy along a tree. The neighbors struct is deprecated and moved to the library as a generic notifier component. --- include/ouroboros/CMakeLists.txt | 2 - include/ouroboros/cdap.h | 89 -------------------------------------- include/ouroboros/notifier.h | 40 +++++++++++++++++ include/ouroboros/nsm.h | 50 --------------------- include/ouroboros/rib.h | 77 --------------------------------- include/ouroboros/rqueue.h | 71 ------------------------------ include/ouroboros/wrap/ouroboros.i | 4 -- 7 files changed, 40 insertions(+), 293 deletions(-) delete mode 100644 include/ouroboros/cdap.h create mode 100644 include/ouroboros/notifier.h delete mode 100644 include/ouroboros/nsm.h delete mode 100644 include/ouroboros/rib.h delete mode 100644 include/ouroboros/rqueue.h (limited to 'include') diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt index b6edac53..e94d5c6c 100644 --- a/include/ouroboros/CMakeLists.txt +++ b/include/ouroboros/CMakeLists.txt @@ -1,6 +1,5 @@ set(HEADER_FILES cacep.h - cdap.h cdefs.h dev.h errno.h @@ -8,7 +7,6 @@ set(HEADER_FILES fqueue.h ipcp.h irm.h - nsm.h proto.h qos.h) diff --git a/include/ouroboros/cdap.h b/include/ouroboros/cdap.h deleted file mode 100644 index 46ebca4b..00000000 --- a/include/ouroboros/cdap.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * The Common Distributed Application Protocol - * - * Dimitri Staessens - * Sander Vrijders - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., http://www.fsf.org/about/contact/. - */ - -#ifndef OUROBOROS_CDAP_H -#define OUROBOROS_CDAP_H - -#include - -#include -#include -#include - -#define F_SYNC 0x0001 - -#define INVALID_CDAP_KEY -1 -#define CDAP_PROTO "CDAP" - -enum cdap_opcode { - CDAP_READ = 0, - CDAP_WRITE, - CDAP_START, - CDAP_STOP, - CDAP_CREATE, - CDAP_DELETE -}; - -struct cdap; - -typedef int32_t cdap_key_t; - -__BEGIN_DECLS - -struct cdap * cdap_create(void); - -int cdap_destroy(struct cdap * instance); - -int cdap_add_flow(struct cdap * instance, - int fd); - -int cdap_del_flow(struct cdap * instance, - int fd); - -cdap_key_t * cdap_request_send(struct cdap * instance, - enum cdap_opcode code, - const char * name, - const void * data, - size_t len, - uint32_t flags); - -int cdap_reply_wait(struct cdap * instance, - cdap_key_t key, - uint8_t ** data, - size_t * len); - -cdap_key_t cdap_request_wait(struct cdap * instance, - enum cdap_opcode * opcode, - char ** name, - uint8_t ** data, - size_t * len, - uint32_t * flags); - -int cdap_reply_send(struct cdap * instance, - cdap_key_t key, - int result, - const void * data, - size_t len); - -__END_DECLS - -#endif /* OUROBOROS_CDAP_H */ diff --git a/include/ouroboros/notifier.h b/include/ouroboros/notifier.h new file mode 100644 index 00000000..7a70f95f --- /dev/null +++ b/include/ouroboros/notifier.h @@ -0,0 +1,40 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2017 + * + * Notifier event system using callbacks + * + * Dimitri Staessens + * Sander Vrijders + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., http://www.fsf.org/about/contact/. + */ + +#ifndef OUROBOROS_LIB_NOTIFIER_H +#define OUROBOROS_LIB_NOTIFIER_H + +typedef void (* notifier_fn_t)(int event, + const void * o); + +int notifier_init(void); + +void notifier_fini(void); + +void notifier_event(int event, + const void * o); + +int notifier_reg(notifier_fn_t callback); + +void notifier_unreg(notifier_fn_t callback); + +#endif /* OUROBOROS_LIB_NOTIFIER_H */ diff --git a/include/ouroboros/nsm.h b/include/ouroboros/nsm.h deleted file mode 100644 index d89a2ee4..00000000 --- a/include/ouroboros/nsm.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * The API to instruct the global Namespace Manager - * - * Dimitri Staessens - * Sander Vrijders - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., http://www.fsf.org/about/contact/. - */ - -#ifndef OUROBOROS_NSM_H -#define OUROBOROS_NSM_H - -#include - -#include -#include - -__BEGIN_DECLS - -int nsm_reg(char * name, - char ** dafs, - size_t dafs_size); - -int nsm_unreg(char * name, - char ** dafs, - size_t dafs_size); - -/* - * dafs is an out parameter - * The amount of DAFs is returned - */ -ssize_t nsm_resolve(char * name, - char ** dafs); - -__END_DECLS - -#endif diff --git a/include/ouroboros/rib.h b/include/ouroboros/rib.h deleted file mode 100644 index 281a4f20..00000000 --- a/include/ouroboros/rib.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * Resource Information Base - * - * Dimitri Staessens - * Sander Vrijders - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., http://www.fsf.org/about/contact/. - */ - -#ifndef OUROBOROS_LIB_RIB_H -#define OUROBOROS_LIB_RIB_H - -#include -#include -#include - -#define RIB_ROOT "" - -#define PACK_HASH_ROOT 0x0001 -#define PACK_HASH_ALL 0x0002 - -#define UNPACK_CREATE 0x0001 - -int rib_init(void); - -void rib_fini(void); - -int rib_add(const char * parent, - const char * name); - -int rib_del(char * path); - -ssize_t rib_read(const char * path, - void * data, - size_t len); - -int rib_write(const char * path, - const void * data, - size_t len); - -int rib_put(const char * path, - void * data, - size_t len); - -bool rib_has(const char * path); - -ssize_t rib_children(const char * path, - char *** children); - -char * rib_path_append(char * path, - const char * name); - -char * rib_name_gen(void * data, - size_t len); - -ssize_t rib_pack(const char * path, - uint8_t ** buf, - uint32_t flags); - -int rib_unpack(uint8_t * packed, - size_t len, - uint32_t flags); - -#endif /* OUROBOROS_LIB_RIB_H */ diff --git a/include/ouroboros/rqueue.h b/include/ouroboros/rqueue.h deleted file mode 100644 index 601a4ab6..00000000 --- a/include/ouroboros/rqueue.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2017 - * - * RIB event queues - * - * Dimitri Staessens - * Sander Vrijders - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., http://www.fsf.org/about/contact/. - */ - -#ifndef OUROBOROS_RQUEUE_H -#define OUROBOROS_RQUEUE_H - -#include -#include -#include - -#define RO_READ 0x00000001 -#define RO_MODIFY 0x00000002 -#define RO_CREATE 0x00000004 -#define RO_DELETE 0x00000008 -#define RO_START 0x00000010 -#define RO_STOP 0x00000020 - -#define RO_NO_OPS 0x00000000 -#define RO_ALL_OPS 0xFFFFFFFF - -struct ro_set; - -struct rqueue; - -typedef struct ro_set ro_set_t; -typedef struct rqueue rqueue_t; - -ro_set_t * ro_set_create(void); - -void ro_set_destroy(ro_set_t * set); - -rqueue_t * rqueue_create(void); - -int rqueue_destroy(struct rqueue * rq); - -int ro_set_zero(ro_set_t * set); - -int ro_set_add(ro_set_t * set, - const char * path, - int32_t flags); - -int ro_set_del(ro_set_t * set, - const char * path); - -int32_t rqueue_next(rqueue_t * rq, - char * path); - -int rib_event_wait(ro_set_t * set, - rqueue_t * rq, - const struct timespec * timeout); - -#endif /* OUROBOROS_RQUEUE_H */ diff --git a/include/ouroboros/wrap/ouroboros.i b/include/ouroboros/wrap/ouroboros.i index ebda2453..db5e09f2 100644 --- a/include/ouroboros/wrap/ouroboros.i +++ b/include/ouroboros/wrap/ouroboros.i @@ -23,14 +23,12 @@ %{ #include "ouroboros/cdefs.h" #include "ouroboros/cacep.h" -#include "ouroboros/cdap.h" #include "ouroboros/dev.h" #include "ouroboros/errno.h" #include "ouroboros/fccntl.h" #include "ouroboros/fqueue.h" #include "ouroboros/irm.h" #include "ouroboros/ipcp.h" -#include "ouroboros/nsm.h" #include "ouroboros/qos.h" %} @@ -38,12 +36,10 @@ typedef int pid_t; %include "ouroboros/cdefs.h" %include "ouroboros/cacep.h" -%include "ouroboros/cdap.h" %include "ouroboros/dev.h" %include "ouroboros/errno.h" %include "ouroboros/fccntl.h" %include "ouroboros/fqueue.h" %include "ouroboros/irm.h" %include "ouroboros/ipcp.h" -%include "ouroboros/nsm.h" %include "ouroboros/qos.h" -- cgit v1.2.3