From b1df380d2a58c2368808ee67f3260a0a6e2f0132 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Thu, 11 Feb 2016 12:31:50 +0100 Subject: Added CONTRIBUTORS file --- CONTRIBUTORS | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 CONTRIBUTORS diff --git a/CONTRIBUTORS b/CONTRIBUTORS new file mode 100644 index 00000000..38aadbbc --- /dev/null +++ b/CONTRIBUTORS @@ -0,0 +1,2 @@ +dimitri staessens +sander vrijders -- cgit v1.2.3 From cedcaee9c0074380b627b61f0591d36b54c452f4 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Thu, 11 Feb 2016 12:39:54 +0100 Subject: Fixed the LICENSE file Removed the discussion on how people can use the file. --- LICENSE | 59 ----------------------------------------------------------- 1 file changed, 59 deletions(-) diff --git a/LICENSE b/LICENSE index d511905c..e37680cf 100644 --- a/LICENSE +++ b/LICENSE @@ -278,62 +278,3 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. -- cgit v1.2.3 From b65d57430c77eb48e49ac20f0801289de67ebfe2 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 12 Feb 2016 10:30:17 +0100 Subject: Capitalized names in CONTRIBUTORS --- CONTRIBUTORS | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 38aadbbc..eeff71ad 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,2 +1,5 @@ -dimitri staessens -sander vrijders +This file contains a list of people who have made large contributions to +Ouroboros, in alphabetical order. + +Dimitri Staessens +Sander Vrijders -- cgit v1.2.3 From a59d0c7b448597865c679c9d19ee13de742cea02 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 12 Feb 2016 13:27:40 +0100 Subject: include: Add logging infrastructure Adds the logging infrastructure to the prototype. 2 helper scripts are also provided to compile the prototype in either release or debug mode. In debug mode debugging logs are printed. --- CMakeLists.txt | 7 +++++++ compile_debug.sh | 35 +++++++++++++++++++++++++++++++++++ compile_release.sh | 35 +++++++++++++++++++++++++++++++++++ include/ouroboros/logs.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/da/main.c | 6 ++++-- src/ipcp/main.c | 6 ++++-- src/irm/main.c | 6 ++++-- 7 files changed, 134 insertions(+), 6 deletions(-) create mode 100755 compile_debug.sh create mode 100755 compile_release.sh create mode 100644 include/ouroboros/logs.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c96ce66..6685dc2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,13 @@ add_subdirectory(include) add_subdirectory(src) add_subdirectory(tests) +include(MacroAddCompileFlags) +if (CMAKE_BUILD_TYPE MATCHES Debug) + MACRO_ADD_COMPILE_FLAGS(ipcp -DCONFIG_OUROBOROS_DEBUG) + MACRO_ADD_COMPILE_FLAGS(irm -DCONFIG_OUROBOROS_DEBUG) + MACRO_ADD_COMPILE_FLAGS(da -DCONFIG_OUROBOROS_DEBUG) +endif (CMAKE_BUILD_TYPE MATCHES Debug) + include(FeatureSummary) print_enabled_features() diff --git a/compile_debug.sh b/compile_debug.sh new file mode 100755 index 00000000..0b21b336 --- /dev/null +++ b/compile_debug.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +ME=compile_debug + +if (($# == 1 )) +then + PREFIX=`echo "$1"|sed -e "s,\/$,,"` +else + PREFIX="/usr/local/ouroboros" +fi + +BUILDDIR=build +DEBUGDIR=debug + +echo "$ME: Prefix is $PREFIX" + +echo "$ME: Build directory will be '$BUILDDIR'" +if test -n "$BUILDDIR" ; then + mkdir -p $BUILDDIR || { + echo "$ME: Cannot create directory '$BUILDDIR'" + } +fi +cd $BUILDDIR + +echo "$ME: Debug directory will be '$DEBUGDIR'" +if test -n "$DEBUGDIR" ; then + mkdir -p $DEBUGDIR || { + echo "$ME: Cannot create directory '$DEBUGDIR'" + } +fi +cd $DEBUGDIR + +cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_BUILD_TYPE=Debug ../.. + +make diff --git a/compile_release.sh b/compile_release.sh new file mode 100755 index 00000000..0dad6c91 --- /dev/null +++ b/compile_release.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +ME=compile_release + +if (($# == 1 )) +then + PREFIX=`echo "$1"|sed -e "s,\/$,,"` +else + PREFIX="/usr/local/ouroboros" +fi + +BUILDDIR=build +RELEASEDIR=release + +echo "$ME: Prefix is $PREFIX" + +echo "$ME: Build directory will be '$BUILDDIR'" +if test -n "$BUILDDIR" ; then + mkdir -p $BUILDDIR || { + echo "$ME: Cannot create directory '$BUILDDIR'" + } +fi +cd $BUILDDIR + +echo "$ME: Release directory will be '$RELEASEDIR'" +if test -n "$RELEASEDIR" ; then + mkdir -p $RELEASEDIR || { + echo "$ME: Cannot create directory '$RELEASEDIR'" + } +fi +cd $RELEASEDIR + +cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_BUILD_TYPE=Release ../.. + +make diff --git a/include/ouroboros/logs.h b/include/ouroboros/logs.h new file mode 100644 index 00000000..5366e266 --- /dev/null +++ b/include/ouroboros/logs.h @@ -0,0 +1,45 @@ +/* + * Logging facilities + * + * Sander Vrijders + * + * 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 OUROBOROS_LOGS_H +#define OUROBOROS_LOGS_H + +#include + +#ifndef OUROBOROS_PREFIX +#error You must define OUROBOROS_PREFIX before including this file +#endif + +#define __LOG(PFX, LVL, FMT, ARGS...) \ + do { printf(PFX "(" LVL "): " FMT "\n", ##ARGS); } while (0) + +#define LOG_ERR(FMT, ARGS...) __LOG(OUROBOROS_PREFIX, "ERR", FMT, ##ARGS) +#define LOG_WARN(FMT, ARGS...) __LOG(OUROBOROS_PREFIX, "WARN", FMT, ##ARGS) +#define LOG_INFO(FMT, ARGS...) __LOG(OUROBOROS_PREFIX, "INFO", FMT, ##ARGS) + +#ifdef CONFIG_OUROBOROS_DEBUG +#define LOG_DBG(FMT, ARGS...) __LOG(OUROBOROS_PREFIX, "DBG", FMT, ##ARGS) +#else +#define LOG_DBG(FMT, ARGS...) do { } while (0) +#endif + +#define LOG_MISSING LOG_ERR("Missing code in %s:%d",__FILE__, __LINE__) + +#endif diff --git a/src/da/main.c b/src/da/main.c index 2eeb7b36..e2971dca 100644 --- a/src/da/main.c +++ b/src/da/main.c @@ -1,8 +1,10 @@ -#include +#define OUROBOROS_PREFIX "da" + +#include int main() { - printf("Test of the DA\n"); + LOG_DBG("Test of the DA"); return 0; } diff --git a/src/ipcp/main.c b/src/ipcp/main.c index 19397260..b67b0af9 100644 --- a/src/ipcp/main.c +++ b/src/ipcp/main.c @@ -1,8 +1,10 @@ -#include +#define OUROBOROS_PREFIX "ipcp" + +#include int main() { - printf("Test of the IPCP\n"); + LOG_DBG("Test of the IPCP"); return 0; } diff --git a/src/irm/main.c b/src/irm/main.c index 6388427f..8ab071e0 100644 --- a/src/irm/main.c +++ b/src/irm/main.c @@ -1,8 +1,10 @@ -#include +#define OUROBOROS_PREFIX "irm" + +#include int main() { - printf("Test of the IRM\n"); + LOG_DBG("Test of the IRM"); return 0; } -- cgit v1.2.3 From 3a09997a77fc8b1f7571de4c67c1d4f8381302c0 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 12 Feb 2016 15:16:08 +0100 Subject: include: Add copyright notice Added a copyright notice to the logs.h file --- include/ouroboros/logs.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/ouroboros/logs.h b/include/ouroboros/logs.h index 5366e266..c72fb9ae 100644 --- a/include/ouroboros/logs.h +++ b/include/ouroboros/logs.h @@ -1,7 +1,10 @@ /* + * Ouroboros - Copyright (C) 2016 + * * Logging facilities * * Sander Vrijders + * Francesco Salvestrini * * 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 -- cgit v1.2.3 From 583efb4910a5287d8ca4a35896f751c167ec0d4d Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 12 Feb 2016 15:16:47 +0100 Subject: include: Initial dev.h file Adds the initial dev.h file that applications can use to request IPC services from the Ouroboros stack. --- include/ouroboros/common.h | 51 +++++++++++++++++++++++++++++++++++++++++++++ include/ouroboros/dev.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 include/ouroboros/common.h create mode 100644 include/ouroboros/dev.h diff --git a/include/ouroboros/common.h b/include/ouroboros/common.h new file mode 100644 index 00000000..4d76d230 --- /dev/null +++ b/include/ouroboros/common.h @@ -0,0 +1,51 @@ +/* + * Ouroboros - Copyright (C) 2016 + * + * Common definitions + * + * Sander Vrijders + * + * 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 OUROBOROS_COMMON_H +#define OUROBOROS_COMMON_H + +#include + +typedef uint32_t port_id_t; + +/* FIXME: To be moved into a separate file */ +typedef struct { + char * data; + size_t size; +} buffer_t; + +typedef struct { + char * ap_name; + int ap_id; + char * ae_name; + int ae_id; +} rina_name_t; + +/* FIXME: To be extended to have all QoS params */ +struct qos_spec { + char * name; + char * dif_name; + double delay; + double jitter; +}; + +#endif diff --git a/include/ouroboros/dev.h b/include/ouroboros/dev.h new file mode 100644 index 00000000..217352ef --- /dev/null +++ b/include/ouroboros/dev.h @@ -0,0 +1,52 @@ +/* + * Ouroboros - Copyright (C) 2016 + * + * API for applications + * + * Sander Vrijders + * + * 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 OUROBOROS_DEV_H +#define OUROBOROS_DEV_H + +#include "common.h" + +struct qos_spec * list_qos_cubes(rina_name_t dst, + struct qos_spec min_qos); + +/* Returns file descriptor */ +int ap_reg(rina_name_t name, char ** difs); +int ap_unreg(rina_name_t name, char ** difs); + +/* Returns file descriptor (> 0) */ +int flow_accept(int fd, rina_name_t * name); +int flow_alloc_resp(int fd, int result); + +/* Returns file descriptor */ +int flow_alloc(rina_name_t src, rina_name_t dst, + struct qos_spec qos, int oflags); + +/* If flow is accepted returns a value > 0 */ +int flow_alloc_res(int fd); +int flow_dealloc(int fd); + +/* Wraps around fnctl */ +int flow_cntl(int fd, int oflags); +int flow_write(int fd, buffer_t * sdu); +int flow_read(int fd, buffer_t * sdu); + +#endif -- cgit v1.2.3