diff options
Diffstat (limited to 'include/ouroboros')
46 files changed, 990 insertions, 281 deletions
diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt index 8f248710..4e90bc59 100644 --- a/include/ouroboros/CMakeLists.txt +++ b/include/ouroboros/CMakeLists.txt @@ -8,7 +8,7 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/sockets.h.in" "${CMAKE_CURRENT_BINARY_DIR}/sockets.h" @ONLY) set(HEADER_FILES - cacep.h + cep.h cdefs.h dev.h errno.h @@ -16,6 +16,7 @@ set(HEADER_FILES fqueue.h ipcp.h irm.h + name.h proto.h qos.h ${CMAKE_CURRENT_BINARY_DIR}/version.h diff --git a/include/ouroboros/bitmap.h b/include/ouroboros/bitmap.h index b557b3d1..04467a8a 100644 --- a/include/ouroboros/bitmap.h +++ b/include/ouroboros/bitmap.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Bitmap implementation * @@ -20,8 +20,8 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_BITMAP_H -#define OUROBOROS_BITMAP_H +#ifndef OUROBOROS_LIB_BITMAP_H +#define OUROBOROS_LIB_BITMAP_H #include <stddef.h> #include <unistd.h> @@ -45,4 +45,4 @@ bool bmp_is_id_valid(struct bmp * bmp, bool bmp_is_id_used(struct bmp * bmp, ssize_t id); -#endif /* OUROBOROS_BITMAP_H */ +#endif /* OUROBOROS_LIB_BITMAP_H */ diff --git a/include/ouroboros/btree.h b/include/ouroboros/btree.h index c692ae9e..cf982856 100644 --- a/include/ouroboros/btree.h +++ b/include/ouroboros/btree.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * B-trees * diff --git a/include/ouroboros/cdefs.h b/include/ouroboros/cdefs.h index 5764fb41..f4a5dc65 100644 --- a/include/ouroboros/cdefs.h +++ b/include/ouroboros/cdefs.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * C Definitions * diff --git a/include/ouroboros/cacep.h b/include/ouroboros/cep.h index 6c11b701..4c1737f0 100644 --- a/include/ouroboros/cacep.h +++ b/include/ouroboros/cep.h @@ -1,7 +1,7 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * - * The Common Application Connection Establishment Protocol + * The Ouroboros Connection Establishment Protocol * * Dimitri Staessens <dimitri@ouroboros.rocks> * Sander Vrijders <sander@ouroboros.rocks> @@ -20,20 +20,19 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_CACEP_H -#define OUROBOROS_CACEP_H +#ifndef OUROBOROS_CEP_H +#define OUROBOROS_CEP_H #include <ouroboros/cdefs.h> #include <ouroboros/proto.h> #include <stdint.h> -#include <sys/types.h> -#define CACEP_BUF_STRLEN 64 +#define OCEP_BUF_STRLEN 128 struct conn_info { - char comp_name[CACEP_BUF_STRLEN + 1]; - char protocol[CACEP_BUF_STRLEN + 1]; + char comp_name[OCEP_BUF_STRLEN + 1]; + char protocol[OCEP_BUF_STRLEN + 1]; uint32_t pref_version; enum proto_concrete_syntax pref_syntax; struct proto_field fixed_conc_syntax[PROTO_MAX_FIELDS]; @@ -43,12 +42,12 @@ struct conn_info { __BEGIN_DECLS -int cacep_snd(int fd, - const struct conn_info * in); +int cep_snd(int fd, + const struct conn_info * in); -int cacep_rcv(int fd, - struct conn_info * out); +int cep_rcv(int fd, + struct conn_info * out); __END_DECLS -#endif /* OUROBOROS_CACEP_H */ +#endif /* OUROBOROS_CEP_H */ diff --git a/include/ouroboros/crc32.h b/include/ouroboros/crc32.h index 4a2abafa..eb610797 100644 --- a/include/ouroboros/crc32.h +++ b/include/ouroboros/crc32.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * 32-bit Cyclic Redundancy Check * @@ -20,8 +20,8 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_CRC32_H -#define OUROBOROS_CRC32_H +#ifndef OUROBOROS_LIB_CRC32_H +#define OUROBOROS_LIB_CRC32_H #include <stdint.h> #include <stddef.h> @@ -32,4 +32,4 @@ void crc32(uint32_t * crc, const void * buf, size_t len); -#endif /* OUROBOROS_CRC32_H */ +#endif /* OUROBOROS_LIB_CRC32_H */ diff --git a/include/ouroboros/crypt.h b/include/ouroboros/crypt.h new file mode 100644 index 00000000..28fe63b2 --- /dev/null +++ b/include/ouroboros/crypt.h @@ -0,0 +1,56 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2024 + * + * Cryptography + * + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> + * + * 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_CRYPT_H +#define OUROBOROS_LIB_CRYPT_H + +#include <ouroboros/shm_du_buff.h> +#include <ouroboros/utils.h> + +#define SYMMKEYSZ 32 + +struct crypt_info { + uint16_t flags; + void * ctx; + uint8_t key[SYMMKEYSZ]; +}; + +int crypt_dh_pkp_create(void ** pkp, + uint8_t * pk); + +void crypt_dh_pkp_destroy(void * pkp); + +int crypt_dh_derive(void * pkp, + buffer_t pk, + uint8_t * s); + +int crypt_encrypt(struct crypt_info * info, + struct shm_du_buff * sdb); + +int crypt_decrypt(struct crypt_info * info, + struct shm_du_buff * sdb); + +int crypt_init(struct crypt_info * info); + +void crypt_fini(struct crypt_info * info); + +#endif /* OUROBOROS_LIB_CRYPT_H */ diff --git a/include/ouroboros/dev.h b/include/ouroboros/dev.h index c402abd6..6e643a2c 100644 --- a/include/ouroboros/dev.h +++ b/include/ouroboros/dev.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * API for applications * diff --git a/include/ouroboros/endian.h b/include/ouroboros/endian.h index 530f66ba..addb2ed3 100644 --- a/include/ouroboros/endian.h +++ b/include/ouroboros/endian.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Endianness * @@ -20,9 +20,8 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_ENDIAN_H -#define OUROBOROS_ENDIAN_H - +#ifndef OUROBOROS_LIB_ENDIAN_H +#define OUROBOROS_LIB_ENDIAN_H #if defined(__linux__) || defined(__CYGWIN__) || \ (defined(__MACH__) && !defined(__APPLE__)) @@ -73,4 +72,4 @@ #define hton16(x) htobe16(x) #define ntoh16(x) betoh16(x) -#endif /* OUROBOROS_ENDIAN_H */ +#endif /* OUROBOROS_LIB_ENDIAN_H */ diff --git a/include/ouroboros/errno.h b/include/ouroboros/errno.h index 06f33bef..25e776df 100644 --- a/include/ouroboros/errno.h +++ b/include/ouroboros/errno.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Ouroboros specific error numbers * @@ -31,7 +31,8 @@ #define EIPCP 1003 /* Failed to communicate with IPCP */ #define EIPCPSTATE 1004 /* Target in wrong state */ #define EFLOWDOWN 1005 /* Flow is down */ -#define ECRYPT 1006 /* Encryption error */ -#define ENAME 1007 /* Naming error */ +#define EFLOWPEER 1006 /* Flow is down (peer timed out) */ +#define ECRYPT 1007 /* Encryption error */ +#define ENAME 1008 /* Naming error */ #endif /* OUROBOROS_ERRNO_H */ diff --git a/include/ouroboros/fccntl.h b/include/ouroboros/fccntl.h index e9f979f3..aa2b0d14 100644 --- a/include/ouroboros/fccntl.h +++ b/include/ouroboros/fccntl.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Flow and FRCT connection control * diff --git a/include/ouroboros/flow.h b/include/ouroboros/flow.h new file mode 100644 index 00000000..e6bf8886 --- /dev/null +++ b/include/ouroboros/flow.h @@ -0,0 +1,54 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2024 + * + * Flows + * + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> + * + * 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_FLOW_H +#define OUROBOROS_LIB_FLOW_H + +#include <ouroboros/qos.h> + +#include <sys/types.h> + + enum flow_state { /* DO NOT CHANGE ORDER! */ + FLOW_INIT = 0, + FLOW_ALLOC_PENDING, + FLOW_ACCEPT_PENDING, + FLOW_ALLOCATED, + FLOW_DEALLOC_PENDING, + FLOW_DEALLOCATED, + FLOW_DESTROY, /* TODO: REMOVE! */ + FLOW_NULL +}; + +struct flow_info { + int id; + + pid_t n_pid; + pid_t n_1_pid; + + time_t mpl; + + struct qos_spec qs; + + enum flow_state state; +}; + +#endif /* OUROBOROS_LIB_FLOW_H */ diff --git a/include/ouroboros/fqueue.h b/include/ouroboros/fqueue.h index f6828a4d..8eb2ff50 100644 --- a/include/ouroboros/fqueue.h +++ b/include/ouroboros/fqueue.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Flow queues * @@ -33,7 +33,8 @@ enum fqtype { FLOW_DOWN = (1 << 1), FLOW_UP = (1 << 2), FLOW_ALLOC = (1 << 3), - FLOW_DEALLOC = (1 << 4) + FLOW_DEALLOC = (1 << 4), + FLOW_PEER = (1 << 5) }; struct flow_set; diff --git a/include/ouroboros/hash.h b/include/ouroboros/hash.h index 917856a1..6b0087ce 100644 --- a/include/ouroboros/hash.h +++ b/include/ouroboros/hash.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Hashing functions * @@ -25,49 +25,60 @@ #include "config.h" -#include <ouroboros/endian.h> +#include <ouroboros/ipcp.h> -#ifdef HAVE_LIBGCRYPT -#include <gcrypt.h> -#endif #include <stdint.h> #include <stddef.h> /* Hash algorithms */ enum hash_algo { -#ifdef HAVE_LIBGCRYPT - HASH_CRC32 = GCRY_MD_CRC32, - HASH_MD5 = GCRY_MD_MD5, - HASH_SHA3_224 = GCRY_MD_SHA3_224, - HASH_SHA3_256 = GCRY_MD_SHA3_256, - HASH_SHA3_384 = GCRY_MD_SHA3_384, - HASH_SHA3_512 = GCRY_MD_SHA3_512 -#else - HASH_CRC32 = 0, + HASH_SHA3_224 = DIR_HASH_SHA3_224, + HASH_SHA3_256 = DIR_HASH_SHA3_256, + HASH_SHA3_384 = DIR_HASH_SHA3_384, + HASH_SHA3_512 = DIR_HASH_SHA3_512, + HASH_CRC32, HASH_MD5, - HASH_SHA3_224, - HASH_SHA3_256, - HASH_SHA3_384, - HASH_SHA3_512 -#endif }; -#define HASH_FMT "%02x%02x%02x%02x" -#define HASH_VAL(hash) \ - (betoh32(*(uint32_t *) hash) & 0xFF000000) >> 24, \ - (betoh32(*(uint32_t *) hash) & 0x00FF0000) >> 16, \ - (betoh32(*(uint32_t *) hash) & 0x0000FF00) >> 8, \ - (betoh32(*(uint32_t *) hash) & 0x000000FF) +#define HASH_FMT32 "%02x%02x%02x%02x" +#define HASH_VAL32(hash) \ + (hash)[0], (hash)[1], (hash)[2], (hash)[3] + +#define HASH_FMT64 HASH_FMT32 HASH_FMT32 +#define HASH_VAL64(hash64) \ + HASH_VAL32(hash64), HASH_VAL32(hash64 + 4) + +#define HASH_FMT128 HASH_FMT64 HASH_FMT64 +#define HASH_VAL128(hash128) \ + HASH_VAL64(hash128), HASH_VAL64(hash128 + 8) + +#define HASH_FMT224 HASH_FMT128 HASH_FMT64 HASH_FMT32 +#define HASH_VAL224(hash224) \ + HASH_VAL128(hash224), HASH_VAL64(hash224 + 16), \ + HASH_VAL32(hash224 + 24) + +#define HASH_FMT256 HASH_FMT128 HASH_FMT128 +#define HASH_VAL256(hash256) \ + HASH_VAL128(hash256), HASH_VAL128(hash256 + 16) + +#define HASH_FMT384 HASH_FMT256 HASH_FMT128 +#define HASH_VAL384(hash384) \ + HASH_VAL256(hash384), HASH_VAL128(hash384 + 32) + +#define HASH_FMT512 HASH_FMT256 HASH_FMT256 +#define HASH_VAL512(hash512) \ + HASH_VAL256(hash512), HASH_VAL256(hash512 + 32) + uint16_t hash_len(enum hash_algo algo); -void mem_hash(enum hash_algo algo, - void * dst, - const uint8_t * buf, - size_t len); +void mem_hash(enum hash_algo algo, + void * dst, + const uint8_t * buf, + size_t len); -void str_hash(enum hash_algo algo, - void * dst, - const char * str); +void str_hash(enum hash_algo algo, + void * dst, + const char * str); #endif /* OUROBOROS_LIB_HASH_H */ diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h index 3cd40771..378d724a 100644 --- a/include/ouroboros/ipcp-dev.h +++ b/include/ouroboros/ipcp-dev.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Additional API for IPCPs * @@ -20,24 +20,25 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#include <ouroboros/shm_rdrbuff.h> -#include <ouroboros/qoscube.h> +#ifndef OUROBOROS_LIB_IPCP_DEV_H +#define OUROBOROS_LIB_IPCP_DEV_H -#ifndef OUROBOROS_IPCP_DEV_H -#define OUROBOROS_IPCP_DEV_H +#include <ouroboros/ipcp.h> +#include <ouroboros/qoscube.h> +#include <ouroboros/shm_rdrbuff.h> +#include <ouroboros/utils.h> -int ipcp_create_r(int result); +int ipcp_create_r(const struct ipcp_info * info); -int ipcp_flow_req_arr(const uint8_t * dst, - size_t len, +int ipcp_flow_req_arr(const buffer_t * dst, qosspec_t qs, - const void * data, - size_t dlen); + time_t mpl, + const buffer_t * data); -int ipcp_flow_alloc_reply(int fd, - int response, - const void * data, - size_t len); +int ipcp_flow_alloc_reply(int fd, + int response, + time_t mpl, + const buffer_t * data); int ipcp_flow_read(int fd, struct shm_du_buff ** sdb); @@ -45,6 +46,14 @@ int ipcp_flow_read(int fd, int ipcp_flow_write(int fd, struct shm_du_buff * sdb); +int np1_flow_read(int fd, + struct shm_du_buff ** sdb); + +int np1_flow_write(int fd, + struct shm_du_buff * sdb); + +int ipcp_flow_dealloc(int fd); + int ipcp_flow_fini(int fd); int ipcp_flow_get_qoscube(int fd, @@ -57,4 +66,4 @@ int ipcp_sdb_reserve(struct shm_du_buff ** sdb, void ipcp_sdb_release(struct shm_du_buff * sdb); -#endif /* OUROBOROS_IPCP_DEV_H */ +#endif /* OUROBOROS_LIB_IPCP_DEV_H */ diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h index a1bdae70..42c4dfa4 100644 --- a/include/ouroboros/ipcp.h +++ b/include/ouroboros/ipcp.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * IPCP definitions and policies * @@ -26,14 +26,23 @@ #include <stdint.h> #include <unistd.h> #include <stdbool.h> +#include <sys/types.h> +#define IPCP_NAME_SIZE 255 #define LAYER_NAME_SIZE 255 +#define DEV_NAME_SIZE 255 + +enum ipcp_state { + IPCP_INIT = 0, + IPCP_BOOT, + IPCP_OPERATIONAL, + IPCP_BOOTSTRAPPED, + IPCP_ENROLLED, + IPCP_SHUTDOWN, + IPCP_NULL +}; -/* - * NOTE: the IRMd uses this order to select an IPCP - * for flow allocation. - */ -enum ipcp_type { +enum ipcp_type { /* IRMd uses order to select an IPCP for flow allocation. */ IPCP_LOCAL = 0, IPCP_UNICAST, IPCP_BROADCAST, @@ -43,60 +52,138 @@ enum ipcp_type { IPCP_INVALID }; +struct ipcp_info { + enum ipcp_type type; + pid_t pid; + char name[IPCP_NAME_SIZE + 1]; + enum ipcp_state state; +}; + +/* Unicast IPCP components. */ +#define DT_COMP "Data Transfer" +#define MGMT_COMP "Management" + /* Unicast IPCP policies */ enum pol_addr_auth { - ADDR_AUTH_FLAT_RANDOM = 0 + ADDR_AUTH_FLAT_RANDOM = 0, + ADDR_AUTH_INVALID }; enum pol_routing { ROUTING_LINK_STATE = 0, ROUTING_LINK_STATE_LFA, - ROUTING_LINK_STATE_ECMP + ROUTING_LINK_STATE_ECMP, + ROUTING_INVALID }; enum pol_cong_avoid { CA_NONE = 0, - CA_MB_ECN + CA_MB_ECN, + CA_INVALID +}; + +struct dt_config { + uint8_t addr_size; + uint8_t eid_size; + uint8_t max_ttl; + enum pol_routing routing_type; +}; + +/* IPCP configuration */ +struct uni_config { + struct dt_config dt; + enum pol_addr_auth addr_auth_type; + enum pol_cong_avoid cong_avoid; }; +struct eth_config { + char dev[DEV_NAME_SIZE + 1]; + uint16_t ethertype; /* DIX only*/ +}; + +struct udp_config { + uint32_t ip_addr; + uint32_t dns_addr; + uint16_t port; +}; + +/* Layers */ enum pol_dir_hash { - DIR_HASH_SHA3_224 = 0, + DIR_HASH_SHA3_224, DIR_HASH_SHA3_256, DIR_HASH_SHA3_384, - DIR_HASH_SHA3_512 + DIR_HASH_SHA3_512, + DIR_HASH_INVALID }; -/* Info reported back to the IRMd about the layer on enrollment */ struct layer_info { - char layer_name[LAYER_NAME_SIZE + 1]; - int dir_hash_algo; + char name[LAYER_NAME_SIZE + 1]; + enum pol_dir_hash dir_hash_algo; }; /* Structure to configure the first IPCP */ struct ipcp_config { - struct layer_info layer_info; + struct layer_info layer_info; + enum ipcp_type type; + + union { + struct uni_config unicast; + struct udp_config udp; + struct eth_config eth; + }; +}; - enum ipcp_type type; +/* default configurations */ +static const struct ipcp_config local_default_conf = { + .type = IPCP_LOCAL, + .layer_info = { + .dir_hash_algo = DIR_HASH_SHA3_256 + } +}; - /* Unicast */ - uint8_t addr_size; - uint8_t eid_size; - uint8_t max_ttl; +static const struct ipcp_config eth_dix_default_conf = { + .type = IPCP_ETH_DIX, + .layer_info = { + .dir_hash_algo = DIR_HASH_SHA3_256 + }, + .eth = { + .ethertype=0xA000, + } +}; - enum pol_addr_auth addr_auth_type; - enum pol_routing routing_type; - enum pol_cong_avoid cong_avoid; +static const struct ipcp_config eth_llc_default_conf = { + .type = IPCP_ETH_LLC, + .layer_info = { + .dir_hash_algo = DIR_HASH_SHA3_256 + } +}; - /* UDP */ - uint32_t ip_addr; - uint32_t dns_addr; - uint16_t port; +static const struct ipcp_config udp_default_conf = { + .type = IPCP_UDP, + .udp = { + .port = 3435 + } +}; - /* Ethernet */ - char * dev; +static const struct ipcp_config uni_default_conf = { + .type = IPCP_UNICAST, + .layer_info = { + .dir_hash_algo = DIR_HASH_SHA3_256 + }, + .unicast = { + .dt = { + .addr_size = 4, + .eid_size = 8, + .max_ttl = 60, + .routing_type = ROUTING_LINK_STATE + }, + .addr_auth_type = ADDR_AUTH_FLAT_RANDOM, + .cong_avoid = CA_MB_ECN + } +}; - /* Ethernet DIX */ - uint16_t ethertype; +static const struct ipcp_config bc_default_conf = { + .type = IPCP_BROADCAST }; #endif /* OUROBOROS_IPCP_H */ diff --git a/include/ouroboros/irm.h b/include/ouroboros/irm.h index d2a4c263..0105f88e 100644 --- a/include/ouroboros/irm.h +++ b/include/ouroboros/irm.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * The API to instruct the IPC Resource Manager * @@ -25,36 +25,16 @@ #include <ouroboros/cdefs.h> #include <ouroboros/ipcp.h> +#include <ouroboros/name.h> #include <ouroboros/qos.h> #include <sys/types.h> -/* Unicast IPCP components. */ -#define DT_COMP "Data Transfer" -#define MGMT_COMP "Management" - -/* Name binding options. */ -#define BIND_AUTO 0x01 - -#define NAME_SIZE 256 -#define LAYER_SIZE LAYER_NAME_SIZE - -/* Load balancing policy for incoming flows. */ -enum pol_balance { - LB_RR = 0, - LB_SPILL -}; - -struct ipcp_info { +struct ipcp_list_info { pid_t pid; enum ipcp_type type; char name[NAME_SIZE]; - char layer[LAYER_SIZE]; -}; - -struct name_info { - char name[NAME_SIZE]; - enum pol_balance pol_lb; + char layer[LAYER_NAME_SIZE]; }; __BEGIN_DECLS @@ -64,7 +44,7 @@ pid_t irm_create_ipcp(const char * name, int irm_destroy_ipcp(pid_t pid); -ssize_t irm_list_ipcps(struct ipcp_info ** ipcps); +ssize_t irm_list_ipcps(struct ipcp_list_info ** ipcps); int irm_enroll_ipcp(pid_t pid, const char * dst); diff --git a/include/ouroboros/list.h b/include/ouroboros/list.h index 408aa64e..f3ea0e46 100644 --- a/include/ouroboros/list.h +++ b/include/ouroboros/list.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Simple doubly linked list implementation. * @@ -61,6 +61,6 @@ void list_del(struct list_head * e); void list_move(struct list_head * dst, struct list_head * src); -bool list_is_empty(struct list_head * h); +bool list_is_empty(const struct list_head * h); #endif /* OUROBOROS_LIB_LIST_H */ diff --git a/include/ouroboros/local-dev.h b/include/ouroboros/local-dev.h index 103fe37b..da62e31c 100644 --- a/include/ouroboros/local-dev.h +++ b/include/ouroboros/local-dev.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Optimized calls for the local IPCPs * @@ -20,12 +20,12 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_LOCAL_DEV_H -#define OUROBOROS_LOCAL_DEV_H +#ifndef OUROBOROS_LIB_LOCAL_DEV_H +#define OUROBOROS_LIB_LOCAL_DEV_H ssize_t local_flow_read(int fd); int local_flow_write(int fd, size_t idx); -#endif /* OUROBOROS_LOCAL_DEV_H */ +#endif /* OUROBOROS_LIB_LOCAL_DEV_H */ diff --git a/include/ouroboros/lockfile.h b/include/ouroboros/lockfile.h index b188d2b4..85a57313 100644 --- a/include/ouroboros/lockfile.h +++ b/include/ouroboros/lockfile.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Lockfile for Ouroboros * @@ -20,8 +20,8 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_LOCKFILE_H -#define OUROBOROS_LOCKFILE_H +#ifndef OUROBOROS_LIB_LOCKFILE_H +#define OUROBOROS_LIB_LOCKFILE_H #include <sys/types.h> @@ -37,4 +37,4 @@ void lockfile_destroy(struct lockfile * lf); pid_t lockfile_owner(struct lockfile * lf); -#endif +#endif /* OUROBOROS_LIB_LOCKFILE_H */ diff --git a/include/ouroboros/logs.h b/include/ouroboros/logs.h index bffba477..db49ae32 100644 --- a/include/ouroboros/logs.h +++ b/include/ouroboros/logs.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Logging facilities * @@ -20,21 +20,19 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_LOGS_H -#define OUROBOROS_LOGS_H - -#include <unistd.h> -#include <stdio.h> -#include <stdbool.h> -#include <syslog.h> +#ifndef OUROBOROS_LIB_LOGS_H +#define OUROBOROS_LIB_LOGS_H #ifndef OUROBOROS_PREFIX #error You must define OUROBOROS_PREFIX before including this file #endif -void log_init(bool sysout); +#include <ouroboros/hash.h> -void log_fini(void); +#include <unistd.h> +#include <stdio.h> +#include <stdbool.h> +#include <syslog.h> #define CLR_RED "\x1b[31m" #define CLR_GREEN "\x1b[32m" @@ -48,28 +46,61 @@ void log_fini(void); extern bool log_syslog; -#define __olog(CLR, LVL, SYSLVL, ...) \ - do { \ - if (log_syslog) { \ - syslog(SYSLVL, OUROBOROS_PREFIX ": " \ - __VA_ARGS__); \ - } else { \ - printf(CLR "==%05d== " OUROBOROS_PREFIX \ - "(" LVL "): ", getpid()); \ - printf(__VA_ARGS__); \ - printf(CLR_RESET "\n"); \ - fflush(stdout); \ - } \ +void log_init(bool sysout); + +void log_fini(void); + + +#define __olog(CLR, LVL, SYSLVL, ...) \ + do { \ + if (log_syslog) { \ + syslog(SYSLVL, __VA_ARGS__); \ + } else { \ + printf(CLR "==%05d== " OUROBOROS_PREFIX \ + "(" LVL "): ", getpid()); \ + printf(__VA_ARGS__); \ + printf(CLR_RESET "\n"); \ + fflush(stdout); \ + } \ + } while (0) + +#define __olog_id(CLR, LVL, SYSLVL, id, fmt, ...) \ + do { \ + if (log_syslog) { \ + syslog(SYSLVL, "[" HASH_FMT64 "] " fmt, \ + HASH_VAL64(id), ## __VA_ARGS__); \ + } else { \ + printf(CLR "==%05d== " OUROBOROS_PREFIX \ + "(" LVL "): ", getpid()); \ + printf("[" HASH_FMT64 "] " fmt, \ + HASH_VAL64(id), ## __VA_ARGS__); \ + printf(CLR_RESET "\n"); \ + fflush(stdout); \ + } \ } while (0) -#define log_err(...) __olog(CLR_RED, ERROR_CODE, LOG_ERR, __VA_ARGS__) -#define log_warn(...) __olog(CLR_YELLOW, WARN_CODE, LOG_WARNING, __VA_ARGS__) -#define log_info(...) __olog(CLR_GREEN, INFO_CODE, LOG_INFO, __VA_ARGS__) +#define log_err(...) \ + __olog(CLR_RED, ERROR_CODE, LOG_ERR, __VA_ARGS__) +#define log_warn(...) \ + __olog(CLR_YELLOW, WARN_CODE, LOG_WARNING, __VA_ARGS__) +#define log_info(...) \ + __olog(CLR_GREEN, INFO_CODE, LOG_INFO, __VA_ARGS__) + + +#define log_err_id(id, fmt, ...) \ + __olog_id(CLR_RED, ERROR_CODE, LOG_ERR, id, fmt, ## __VA_ARGS__) +#define log_warn_id(id, fmt, ...) \ + __olog_id(CLR_YELLOW, WARN_CODE, LOG_WARNING, id, fmt, ## __VA_ARGS__) +#define log_info_id(id, fmt, ...) \ + __olog_id(CLR_GREEN, INFO_CODE, LOG_INFO, id, fmt, ## __VA_ARGS__) #ifdef CONFIG_OUROBOROS_DEBUG #define log_dbg(...) __olog("", DEBUG_CODE, LOG_DEBUG, __VA_ARGS__) +#define log_dbg_id(id, fmt, ...) \ + __olog_id("", DEBUG_CODE, LOG_DEBUG, id, fmt, ## __VA_ARGS__) #else #define log_dbg(...) do { } while (0) +#define log_dbg_id(...) do { } while (0) #endif -#endif /* OUROBOROS_LOGS_H */ +#endif /* OUROBOROS_LIB_LOGS_H */ diff --git a/include/ouroboros/md5.h b/include/ouroboros/md5.h index ab01996d..85a22544 100644 --- a/include/ouroboros/md5.h +++ b/include/ouroboros/md5.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * MD5 algorithm * diff --git a/include/ouroboros/name.h b/include/ouroboros/name.h new file mode 100644 index 00000000..9d77a90b --- /dev/null +++ b/include/ouroboros/name.h @@ -0,0 +1,40 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2024 + * + * Names + * + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> + * + * 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_NAME_H +#define OUROBOROS_NAME_H + +#define NAME_SIZE 255 +#define BIND_AUTO 0x01 + +enum pol_balance { + LB_RR = 0, + LB_SPILL, + LB_INVALID +}; + +struct name_info { + char name[NAME_SIZE + 1]; + enum pol_balance pol_lb; +}; + +#endif /* OUROBOROS_NAME_H */ diff --git a/include/ouroboros/notifier.h b/include/ouroboros/notifier.h index 429a8d97..db945f1e 100644 --- a/include/ouroboros/notifier.h +++ b/include/ouroboros/notifier.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Notifier event system using callbacks * diff --git a/include/ouroboros/np1_flow.h b/include/ouroboros/np1_flow.h index c82257de..31720eea 100644 --- a/include/ouroboros/np1_flow.h +++ b/include/ouroboros/np1_flow.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Adapter functions for N + 1 flow descriptors * @@ -20,19 +20,31 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_NP1_FLOW_H -#define OUROBOROS_NP1_FLOW_H +#ifndef OUROBOROS_LIB_NP1_FLOW_H +#define OUROBOROS_LIB_NP1_FLOW_H #include <ouroboros/qos.h> #include <unistd.h> -int np1_flow_alloc(pid_t n_pid, - int flow_id, - qosspec_t qs); +int np1_flow_alloc(pid_t n_pid, + int flow_id); int np1_flow_resp(int flow_id); -int np1_flow_dealloc(int flow_id); +int np1_flow_dealloc(int flow_id, + time_t timeo); -#endif /* OUROBOROS_NP1_FLOW_H */ +static const qosspec_t qos_np1 = { + .delay = UINT32_MAX, + .bandwidth = 0, + .availability = 0, + .loss = UINT32_MAX, + .ber = UINT32_MAX, + .in_order = 0, + .max_gap = UINT32_MAX, + .cypher_s = 0, + .timeout = 0 +}; + +#endif /* OUROBOROS_LIB_NP1_FLOW_H */ diff --git a/include/ouroboros/proc.h b/include/ouroboros/proc.h new file mode 100644 index 00000000..80c67227 --- /dev/null +++ b/include/ouroboros/proc.h @@ -0,0 +1,44 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2024 + * + * Processes and Programs + * + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> + * + * 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_PROC_H +#define OUROBOROS_LIB_PROC_H + +#include <sys/types.h> + +#define PROG_NAME_SIZE 255 +#define PROG_PATH_SIZE 255 + +/* Processes */ +struct proc_info { + pid_t pid; + char prog[PROG_NAME_SIZE + 1]; /* program instantiated */ + +}; + +/* Programs */ +struct prog_info { + char name[PROG_NAME_SIZE + 1]; + char path[PROG_PATH_SIZE + 1]; +}; + +#endif /* OUROBOROS_LIB_PROC_H */ diff --git a/include/ouroboros/proto.h b/include/ouroboros/proto.h index f289e761..5c863c8b 100644 --- a/include/ouroboros/proto.h +++ b/include/ouroboros/proto.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Protocol syntax definitions * diff --git a/include/ouroboros/protobuf.h b/include/ouroboros/protobuf.h new file mode 100644 index 00000000..9d38afb1 --- /dev/null +++ b/include/ouroboros/protobuf.h @@ -0,0 +1,117 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2024 + * + * Protobuf syntax conversion + * + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> + * + * 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_PROTOBUF_H +#define OUROBOROS_LIB_PROTOBUF_H + +#include <ouroboros/flow.h> +#include <ouroboros/qos.h> +#include <ouroboros/ipcp.h> +#include <ouroboros/irm.h> +#include <ouroboros/serdes-irm.h> +#include <ouroboros/serdes-oep.h> + +#include "ipcp_config.pb-c.h" +typedef IpcpConfigMsg ipcp_config_msg_t; +typedef DtConfigMsg dt_config_msg_t; +typedef EthConfigMsg eth_config_msg_t; +typedef UdpConfigMsg udp_config_msg_t; +typedef UniConfigMsg uni_config_msg_t; + +#include "ipcp.pb-c.h" +typedef IpcpMsg ipcp_msg_t; + +#include "irm.pb-c.h" +typedef IrmMsg irm_msg_t; +typedef TimespecMsg timespec_msg_t; +typedef IpcpInfoMsg ipcp_info_msg_t; +typedef IpcpListMsg ipcp_list_msg_t; + +#include "model.pb-c.h" +typedef FlowInfoMsg flow_info_msg_t; +typedef LayerInfoMsg layer_info_msg_t; +typedef NameInfoMsg name_info_msg_t; +typedef QosspecMsg qosspec_msg_t; + +#include "enroll.pb-c.h" +typedef EnrollReqMsg enroll_req_msg_t; +typedef EnrollRespMsg enroll_resp_msg_t; +typedef EnrollAckMsg enroll_ack_msg_t; + +/* IPCP configuration */ +timespec_msg_t * timespec_s_to_msg(const struct timespec * s); + +struct timespec timespec_msg_to_s(timespec_msg_t * msg); + +flow_info_msg_t * flow_info_s_to_msg(const struct flow_info * s); + +struct flow_info flow_info_msg_to_s(const flow_info_msg_t * msg); + +layer_info_msg_t * layer_info_s_to_msg(const struct layer_info * s); + +struct layer_info layer_info_msg_to_s(const layer_info_msg_t * msg); + +ipcp_info_msg_t * ipcp_info_s_to_msg(const struct ipcp_info * s); + +struct ipcp_info ipcp_info_msg_to_s(const ipcp_info_msg_t * msg); + +dt_config_msg_t * dt_config_s_to_msg(const struct dt_config * s); + +struct dt_config dt_config_msg_to_s(const dt_config_msg_t * msg); + +uni_config_msg_t * uni_config_s_to_msg(const struct uni_config * s); + +struct uni_config uni_config_msg_to_s(const uni_config_msg_t * msg); + +eth_config_msg_t * eth_config_s_to_msg(const struct eth_config * s); + +struct eth_config eth_config_msg_to_s(const eth_config_msg_t * msg); + +udp_config_msg_t * udp_config_s_to_msg(const struct udp_config * s); + +struct udp_config udp_config_msg_to_s(const udp_config_msg_t * msg); + +ipcp_config_msg_t * ipcp_config_s_to_msg(const struct ipcp_config * s); + +struct ipcp_config ipcp_config_msg_to_s(const ipcp_config_msg_t * msg); + +/* QoS */ + +qosspec_msg_t * qos_spec_s_to_msg(const struct qos_spec * s); + +struct qos_spec qos_spec_msg_to_s(const qosspec_msg_t * msg); + +/* Enrollment */ + +enroll_req_msg_t * enroll_req_s_to_msg(const struct enroll_req * s); + +struct enroll_req enroll_req_msg_to_s(const enroll_req_msg_t * msg); + +enroll_resp_msg_t * enroll_resp_s_to_msg(const struct enroll_resp * s); + +struct enroll_resp enroll_resp_msg_to_s(const enroll_resp_msg_t * msg); + +enroll_ack_msg_t * enroll_ack_s_to_msg(const struct enroll_ack * s); + +struct enroll_ack enroll_ack_msg_to_s(const enroll_ack_msg_t * msg); + +#endif /* OUROBOROS_LIB_PROTOBUF_H */ diff --git a/include/ouroboros/pthread.h b/include/ouroboros/pthread.h index 735557d2..7044cb5e 100644 --- a/include/ouroboros/pthread.h +++ b/include/ouroboros/pthread.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Useful cleanup functions for pthreads * @@ -20,20 +20,32 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_PTHREAD_H -#define OUROBOROS_PTHREAD_H +#ifndef OUROBOROS_LIB_PTHREAD_H +#define OUROBOROS_LIB_PTHREAD_H #include <pthread.h> +static int __attribute__((unused)) __timedwait(pthread_cond_t * cond, + pthread_mutex_t * mtx, + const struct timespec * abstime) +{ + if (abstime == NULL) + return pthread_cond_wait(cond, mtx); + + return pthread_cond_timedwait(cond, mtx, abstime); +} + +#if defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L /* various cleanup functions for pthread_cleanup_push */ static void __attribute__((unused)) __cleanup_rwlock_unlock(void * rwlock) { pthread_rwlock_unlock((pthread_rwlock_t *) rwlock); } +#endif static void __attribute__((unused)) __cleanup_mutex_unlock(void * mutex) { pthread_mutex_unlock((pthread_mutex_t *) mutex); } -#endif /* OUROBOROS_PTHREAD_H */ +#endif /* OUROBOROS_LIB_PTHREAD_H */ diff --git a/include/ouroboros/qos.h b/include/ouroboros/qos.h index 6391347a..a45e8135 100644 --- a/include/ouroboros/qos.h +++ b/include/ouroboros/qos.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Quality of Service specification * @@ -26,15 +26,18 @@ #include <stdint.h> #include <stdbool.h> +#define DEFAULT_PEER_TIMEOUT 120000 + typedef struct qos_spec { - uint32_t delay; /* In ms */ - uint64_t bandwidth; /* In bits/s */ - uint8_t availability; /* Class of 9s */ - uint32_t loss; /* Packet loss */ - uint32_t ber; /* Bit error rate, errors per billion bits */ - uint8_t in_order; /* In-order delivery, enables FRCT */ - uint32_t max_gap; /* In ms */ - uint16_t cypher_s; /* Cypher strength, 0 = no encryption */ + uint32_t delay; /* In ms. */ + uint64_t bandwidth; /* In bits/s. */ + uint8_t availability; /* Class of 9s. */ + uint32_t loss; /* Packet loss. */ + uint32_t ber; /* Bit error rate, errors per billion bits. */ + uint8_t in_order; /* In-order delivery, enables FRCT. */ + uint32_t max_gap; /* In ms. */ + uint16_t cypher_s; /* Cypher strength (bits), 0 = no encryption. */ + uint32_t timeout; /* Peer timeout time, in ms, 0 = no timeout. */ } qosspec_t; static const qosspec_t qos_raw = { @@ -45,7 +48,8 @@ static const qosspec_t qos_raw = { .ber = 1, .in_order = 0, .max_gap = UINT32_MAX, - .cypher_s = 0 + .cypher_s = 0, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_raw_no_errors = { @@ -56,7 +60,8 @@ static const qosspec_t qos_raw_no_errors = { .ber = 0, .in_order = 0, .max_gap = UINT32_MAX, - .cypher_s = 0 + .cypher_s = 0, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_raw_crypt = { @@ -67,7 +72,8 @@ static const qosspec_t qos_raw_crypt = { .ber = 0, .in_order = 0, .max_gap = UINT32_MAX, - .cypher_s = 256 + .cypher_s = 256, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_best_effort = { @@ -78,7 +84,8 @@ static const qosspec_t qos_best_effort = { .ber = 0, .in_order = 1, .max_gap = UINT32_MAX, - .cypher_s = 0 + .cypher_s = 0, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_best_effort_crypt = { @@ -89,7 +96,8 @@ static const qosspec_t qos_best_effort_crypt = { .ber = 0, .in_order = 1, .max_gap = UINT32_MAX, - .cypher_s = 256 + .cypher_s = 256, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_video = { @@ -100,7 +108,8 @@ static const qosspec_t qos_video = { .ber = 0, .in_order = 1, .max_gap = 100, - .cypher_s = 0 + .cypher_s = 0, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_video_crypt = { @@ -111,7 +120,8 @@ static const qosspec_t qos_video_crypt = { .ber = 0, .in_order = 1, .max_gap = 100, - .cypher_s = 256 + .cypher_s = 256, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_voice = { @@ -122,7 +132,8 @@ static const qosspec_t qos_voice = { .ber = 0, .in_order = 1, .max_gap = 50, - .cypher_s = 0 + .cypher_s = 0, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_voice_crypt = { @@ -133,7 +144,8 @@ static const qosspec_t qos_voice_crypt = { .ber = 0, .in_order = 1, .max_gap = 50, - .cypher_s = 256 + .cypher_s = 256, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_data = { @@ -144,7 +156,8 @@ static const qosspec_t qos_data = { .ber = 0, .in_order = 1, .max_gap = 2000, - .cypher_s = 0 + .cypher_s = 0, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_data_crypt = { @@ -155,7 +168,8 @@ static const qosspec_t qos_data_crypt = { .ber = 0, .in_order = 1, .max_gap = 2000, - .cypher_s = 256 + .cypher_s = 256, + .timeout = DEFAULT_PEER_TIMEOUT }; #endif /* OUROBOROS_QOS_H */ diff --git a/include/ouroboros/qoscube.h b/include/ouroboros/qoscube.h index 48705ffc..ed20484c 100644 --- a/include/ouroboros/qoscube.h +++ b/include/ouroboros/qoscube.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Quality of Service cubes * @@ -20,8 +20,8 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_QOSCUBE_H -#define OUROBOROS_QOSCUBE_H +#ifndef OUROBOROS_LIB_QOSCUBE_H +#define OUROBOROS_LIB_QOSCUBE_H #include <ouroboros/qos.h> @@ -35,4 +35,4 @@ typedef enum qos_cube { qoscube_t qos_spec_to_cube(qosspec_t qs); qosspec_t qos_cube_to_spec(qoscube_t qc); -#endif +#endif /* OUROBOROS_LIB_QOSCUBE_H */ diff --git a/include/ouroboros/random.h b/include/ouroboros/random.h index 1f1ab057..e1b25e5d 100644 --- a/include/ouroboros/random.h +++ b/include/ouroboros/random.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Pseudo random generator * @@ -20,12 +20,12 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_RANDOM_H -#define OUROBOROS_RANDOM_H +#ifndef OUROBOROS_LIB_RANDOM_H +#define OUROBOROS_LIB_RANDOM_H #include <sys/types.h> int random_buffer(void * buf, size_t len); -#endif /* OUROBOROS_RANDOM_H */ +#endif /* OUROBOROS_LIB_RANDOM_H */ diff --git a/include/ouroboros/rib.h b/include/ouroboros/rib.h index 9eab6334..6aabe8f7 100644 --- a/include/ouroboros/rib.h +++ b/include/ouroboros/rib.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * RIB export using FUSE * @@ -23,7 +23,7 @@ #ifndef OUROBOROS_LIB_RIB_H #define OUROBOROS_LIB_RIB_H -#define RIB_PATH_LEN 128 +#define RIB_PATH_LEN 300 #define RIB_SEPARATOR "/" #include <sys/types.h> @@ -53,4 +53,6 @@ int rib_reg(const char * path, void rib_unreg(const char * path); +void rib_cleanup(const char * mnt); + #endif /* OUROBOROS_LIB_RIB_H */ diff --git a/include/ouroboros/serdes-irm.h b/include/ouroboros/serdes-irm.h new file mode 100644 index 00000000..1d041541 --- /dev/null +++ b/include/ouroboros/serdes-irm.h @@ -0,0 +1,79 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2024 + * + * Ouroboros IRM Protocol - serialization/deserialization + * + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 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., http://www.fsf.org/about/contact/. + */ + +#ifndef OUROBOROS_LIB_SERDES_IRM_H +#define OUROBOROS_LIB_SERDES_IRM_H + +#include <ouroboros/flow.h> +#include <ouroboros/ipcp.h> +#include <ouroboros/time.h> +#include <ouroboros/utils.h> + +#include <inttypes.h> + +int flow_alloc__irm_req_ser(buffer_t * buf, + const struct flow_info * flow, + const char * dst, + const struct timespec * timeo); + +int flow_join__irm_req_ser(buffer_t * buf, + const struct flow_info * flow, + const char * dst, + const struct timespec * timeo); + +int flow_accept__irm_req_ser(buffer_t * buf, + const struct flow_info * flow, + const struct timespec * timeo); + +int ipcp_flow_req_arr__irm_req_ser(buffer_t * buf, + const buffer_t * dst, + const struct flow_info * flow, + const buffer_t * data); + +int ipcp_flow_alloc_reply__irm_msg_ser(buffer_t * buf, + const struct flow_info * flow, + int response, + const buffer_t * data); + +/* response to alloc / join / accept / flow_req_arr */ +int flow__irm_result_des(buffer_t * buf, + struct flow_info * flow, + buffer_t * sk); + +int flow_dealloc__irm_req_ser(buffer_t * buf, + const struct flow_info * flow, + const struct timespec * timeo); + +int ipcp_flow_dealloc__irm_req_ser(buffer_t * buf, + const struct flow_info * info); + +int ipcp_create_r__irm_req_ser(buffer_t * buf, + const struct ipcp_info * ipcp); + +int proc_announce__irm_req_ser(buffer_t * buf, + const char * prog); + +int proc_exit__irm_req_ser(buffer_t * buf); + +int irm__irm_result_des(buffer_t * buf); + +#endif /* OUROBOROS_LIB_SERDES_IRM_H*/ diff --git a/include/ouroboros/serdes-oep.h b/include/ouroboros/serdes-oep.h new file mode 100644 index 00000000..69ba71a4 --- /dev/null +++ b/include/ouroboros/serdes-oep.h @@ -0,0 +1,70 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2024 + * + * Ouroboros Enrollment Protocol - serialization/deserialization + * + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 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., http://www.fsf.org/about/contact/. + */ + +#ifndef OUROBOROS_LIB_SERDES_OEP_H +#define OUROBOROS_LIB_SERDES_OEP_H + +#include <ouroboros/ipcp.h> +#include <ouroboros/utils.h> + +#include <sys/time.h> + +/* Enrollment */ + +#define ENROLL_ID_LEN 8 + +struct enroll_req { + /* TODO: Authentication */ + uint8_t id[ENROLL_ID_LEN]; +}; + +struct enroll_resp { + uint8_t id[ENROLL_ID_LEN]; + struct timespec t; + int response; + struct ipcp_config conf; +}; + +struct enroll_ack { + uint8_t id[ENROLL_ID_LEN]; + int result; +}; + +ssize_t enroll_req_ser(const struct enroll_req * req, + buffer_t buf); + +int enroll_req_des(struct enroll_req * req, + const buffer_t buf); + +ssize_t enroll_resp_ser(const struct enroll_resp * resp, + buffer_t buf); + +int enroll_resp_des(struct enroll_resp * resp, + buffer_t buf); + +ssize_t enroll_ack_ser(const struct enroll_ack * ack, + buffer_t buf); + +int enroll_ack_des(struct enroll_ack * ack, + const buffer_t buf); + +#endif /* OUROBOROS_LIB_SERDES_OEP_H*/ diff --git a/include/ouroboros/sha3.h b/include/ouroboros/sha3.h index 41967599..04871f3b 100644 --- a/include/ouroboros/sha3.h +++ b/include/ouroboros/sha3.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * SHA3 algorithm * diff --git a/include/ouroboros/shm_du_buff.h b/include/ouroboros/shm_du_buff.h index da350055..c25d4b95 100644 --- a/include/ouroboros/shm_du_buff.h +++ b/include/ouroboros/shm_du_buff.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Data Buffer element in Random Deletion Ring Buffer * @@ -20,8 +20,8 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_SHM_DU_BUFF_H -#define OUROBOROS_SHM_DU_BUFF_H +#ifndef OUROBOROS_LIB_SHM_DU_BUFF_H +#define OUROBOROS_LIB_SHM_DU_BUFF_H #include <sys/types.h> #include <stdint.h> @@ -34,6 +34,8 @@ uint8_t * shm_du_buff_head(struct shm_du_buff * sdb); uint8_t * shm_du_buff_tail(struct shm_du_buff * sdb); +size_t shm_du_buff_len(struct shm_du_buff * sdb); + uint8_t * shm_du_buff_head_alloc(struct shm_du_buff * sdb, size_t size); @@ -53,4 +55,4 @@ int shm_du_buff_wait_ack(struct shm_du_buff * sdb); int shm_du_buff_ack(struct shm_du_buff * sdb); -#endif /* OUROBOROS_SHM_DU_BUFF_H */ +#endif /* OUROBOROS_LIB_SHM_DU_BUFF_H */ diff --git a/include/ouroboros/shm_flow_set.h b/include/ouroboros/shm_flow_set.h index ba085aef..09e37649 100644 --- a/include/ouroboros/shm_flow_set.h +++ b/include/ouroboros/shm_flow_set.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Management of flow_sets for fqueue * @@ -20,13 +20,18 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_SHM_FLOW_SET_H -#define OUROBOROS_SHM_FLOW_SET_H +#ifndef OUROBOROS_LIB_SHM_FLOW_SET_H +#define OUROBOROS_LIB_SHM_FLOW_SET_H #include <ouroboros/fqueue.h> #include <sys/time.h> +struct flowevent { + int flow_id; + int event; +}; + struct shm_flow_set; struct shm_flow_set * shm_flow_set_create(pid_t pid); @@ -58,7 +63,7 @@ void shm_flow_set_notify(struct shm_flow_set * set, ssize_t shm_flow_set_wait(const struct shm_flow_set * shm_set, size_t idx, - int * fqueue, + struct flowevent * fqueue, const struct timespec * abstime); -#endif /* OUROBOROS_SHM_FLOW_SET_H */ +#endif /* OUROBOROS_LIB_SHM_FLOW_SET_H */ diff --git a/include/ouroboros/shm_rbuff.h b/include/ouroboros/shm_rbuff.h index e853e487..4323d4e1 100644 --- a/include/ouroboros/shm_rbuff.h +++ b/include/ouroboros/shm_rbuff.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Ring buffer for incoming packets * @@ -20,8 +20,8 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_SHM_RBUFF_H -#define OUROBOROS_SHM_RBUFF_H +#ifndef OUROBOROS_LIB_SHM_RBUFF_H +#define OUROBOROS_LIB_SHM_RBUFF_H #include <sys/types.h> #include <sys/time.h> @@ -31,6 +31,7 @@ #define ACL_RDWR 0000 #define ACL_RDONLY 0001 #define ACL_FLOWDOWN 0002 +#define ACL_FLOWPEER 0004 struct shm_rbuff; @@ -65,4 +66,4 @@ ssize_t shm_rbuff_read_b(struct shm_rbuff * rb, size_t shm_rbuff_queued(struct shm_rbuff * rb); -#endif /* OUROBOROS_SHM_RBUFF_H */ +#endif /* OUROBOROS_LIB_SHM_RBUFF_H */ diff --git a/include/ouroboros/shm_rdrbuff.h b/include/ouroboros/shm_rdrbuff.h index 0bce681b..4f9a215a 100644 --- a/include/ouroboros/shm_rdrbuff.h +++ b/include/ouroboros/shm_rdrbuff.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Random Deletion Ring Buffer for Data Units * @@ -20,14 +20,14 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_SHM_RDRBUFF_H -#define OUROBOROS_SHM_RDRBUFF_H +#ifndef OUROBOROS_LIB_SHM_RDRBUFF_H +#define OUROBOROS_LIB_SHM_RDRBUFF_H #include <ouroboros/shm_du_buff.h> -#include <ouroboros/time_utils.h> +#include <ouroboros/time.h> -#include <stdint.h> #include <pthread.h> +#include <stdint.h> #include <sys/types.h> struct shm_rdrbuff; @@ -64,4 +64,4 @@ struct shm_du_buff * shm_rdrbuff_get(struct shm_rdrbuff * rdrb, int shm_rdrbuff_remove(struct shm_rdrbuff * rdrb, size_t idx); -#endif /* OUROBOROS_SHM_RDRBUFF_H */ +#endif /* OUROBOROS_LIB_SHM_RDRBUFF_H */ diff --git a/include/ouroboros/sockets.h.in b/include/ouroboros/sockets.h.in index f1162163..095674a9 100644 --- a/include/ouroboros/sockets.h.in +++ b/include/ouroboros/sockets.h.in @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * The sockets layer to communicate between daemons * @@ -20,35 +20,20 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_SOCKETS_H -#define OUROBOROS_SOCKETS_H +#ifndef OUROBOROS_LIB_SOCKETS_H +#define OUROBOROS_LIB_SOCKETS_H -#include <ouroboros/qos.h> +#include <ouroboros/protobuf.h> #include <sys/types.h> -#include "ipcp_config.pb-c.h" -typedef IpcpConfigMsg ipcp_config_msg_t; -typedef LayerInfoMsg layer_info_msg_t; +#define SOCK_PATH "/var/run/ouroboros/" +#define SOCK_PATH_SUFFIX ".sock" -#include "irmd_messages.pb-c.h" -typedef IrmMsg irm_msg_t; -typedef IpcpInfoMsg ipcp_info_msg_t; -typedef NameInfoMsg name_info_msg_t; - -#include "ipcpd_messages.pb-c.h" -typedef IpcpMsg ipcp_msg_t; - -#include "qosspec.pb-c.h" -typedef QosspecMsg qosspec_msg_t; - -#define SOCK_PATH "/var/run/ouroboros/" -#define SOCK_PATH_SUFFIX ".sock" - -#define IRM_SOCK_PATH SOCK_PATH "irm" SOCK_PATH_SUFFIX +#define IRM_SOCK_PATH SOCK_PATH "irm" SOCK_PATH_SUFFIX #define IPCP_SOCK_PATH_PREFIX SOCK_PATH "ipcp" -#define SOCK_BUF_SIZE @SOCK_BUF_SIZE@ +#define SOCK_BUF_SIZE @SOCK_BUF_SIZE@ /* Returns the full socket path of an IPCP */ char * ipcp_sock_path(pid_t pid); @@ -57,15 +42,11 @@ int server_socket_open(char * file_name); int client_socket_open(char * file_name); -irm_msg_t * send_recv_irm_msg(irm_msg_t * msg); - +int send_recv_msg(buffer_t * buf); -/* qos message conversion needed in different components */ -qosspec_msg_t spec_to_msg(const qosspec_t * qs); - -qosspec_t msg_to_spec(const qosspec_msg_t * msg); +irm_msg_t * send_recv_irm_msg(irm_msg_t * msg); /* cleanup socket when cancelling thread */ void __cleanup_close_ptr(void * o); -#endif +#endif /* OUROBOROS_LIB_SOCKETS_H */ diff --git a/include/ouroboros/test.h b/include/ouroboros/test.h new file mode 100644 index 00000000..096e145c --- /dev/null +++ b/include/ouroboros/test.h @@ -0,0 +1,82 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2024 + * + * Test macros + * + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> + * + * 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_TEST_H +#define OUROBOROS_LIB_TEST_H + +#include <errno.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <sys/wait.h> + +#define TEST_START() \ + do { \ + printf("%s started.\n", __func__); \ + fflush(stdout); \ + } while (0) +#define TEST_SUCCESS() \ + do { \ + printf("%s succeeded.\n", __func__); \ + fflush(stdout); \ + } while (0) + +#define TEST_FAIL() \ + do { \ + printf("%s failed.\n", __func__); \ + fflush(stdout); \ + } while (0) + +#define TEST_END(result) \ + do { if (result == 0) TEST_SUCCESS(); else TEST_FAIL(); } while (0) + +static int __attribute__((unused)) test_assert_fail(int(* testfunc)(void)) +{ + pid_t pid; + int wstatus; + + pid = fork(); + if (pid == -1) { + printf("Failed to fork: %s.\n", strerror(errno)); + return -1; + } + + if (pid == 0) + return testfunc(); /* should abort */ + + waitpid(pid, &wstatus, 0); +#ifdef CONFIG_OUROBOROS_DEBUG + if (WIFSIGNALED(wstatus) && (wstatus == 134 || wstatus == 6)) + return 0; + + printf("Process did not abort, status: %d.\n", wstatus); +#else + if (WIFEXITED(wstatus) && wstatus == 0) + return 0; + + printf("Process did not exit, status: %d.\n", wstatus); +#endif + + return -1; +} + +#endif /* OUROBOROS_LIB_TEST_H */ diff --git a/include/ouroboros/time_utils.h b/include/ouroboros/time.h index 6e51f305..b274c35b 100644 --- a/include/ouroboros/time_utils.h +++ b/include/ouroboros/time.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Time utilities * @@ -20,8 +20,8 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_TIME_UTILS_H -#define OUROBOROS_TIME_UTILS_H +#ifndef OUROBOROS_LIB_TIME_H +#define OUROBOROS_LIB_TIME_H #ifdef MILLION #undef MILLION @@ -37,6 +37,15 @@ #include <time.h> #include <sys/time.h> +#define TIMESPEC_INIT_S(s) {(s), 0} +#define TIMESPEC_INIT_MS(ms) {(ms) / 1000, ((ms) % 1000) * MILLION} +#define TIMESPEC_INIT_US(us) {(us) / MILLION, ((us) % MILLION) * 1000} +#define TIMESPEC_INIT_NS(ns) {(ns) / BILLION, ((ns) % BILLION)} + +#define TIMEVAL_INIT_S(s) {(s), 0} +#define TIMEVAL_INIT_MS(ms) {(ms) / 1000, ((ms) % 1000) * 1000} +#define TIMEVAL_INIT_US(us) {(us) / MILLION, ((us) % MILLION)} + /* functions for timespecs */ #define ts_diff_ns(t0, tx) (((tx)->tv_sec - (t0)->tv_sec) * BILLION \ + ((tx)->tv_nsec - (t0)->tv_nsec)) @@ -118,4 +127,4 @@ (tv)->tv_usec = (ts)->tv_nsec / 1000L; \ } while (0); -#endif /* OUROBOROS_TIME_UTILS_H */ +#endif /* OUROBOROS_LIB_TIME_H */ diff --git a/include/ouroboros/tpm.h b/include/ouroboros/tpm.h index a69549d2..445f9306 100644 --- a/include/ouroboros/tpm.h +++ b/include/ouroboros/tpm.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Threadpool management * diff --git a/include/ouroboros/utils.h b/include/ouroboros/utils.h index 426a143c..93fbf402 100644 --- a/include/ouroboros/utils.h +++ b/include/ouroboros/utils.h @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Handy utilities * @@ -20,15 +20,18 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#ifndef OUROBOROS_UTILS_H -#define OUROBOROS_UTILS_H +#ifndef OUROBOROS_LIB_UTILS_H +#define OUROBOROS_LIB_UTILS_H #include <stdint.h> #include <unistd.h> +#include <string.h> #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #define ABS(a) ((a) > 0 ? (a) : -(a)) +#define clrbuf(buf) do { memset(&(buf), 0, sizeof(buf)); } while (0); +#define freebuf(buf) do { free((buf).data); clrbuf(buf); } while (0); typedef struct { uint8_t * data; @@ -42,7 +45,14 @@ typedef struct { int n_digits(unsigned i); /* gets the application name */ -char * path_strip(char * src); +char * path_strip(const char * src); + +/* functions for copying and destroying arguments list */ +size_t argvlen(const char ** argv); + +char ** argvdup(char ** argv); + +void argvfree(char ** argv); /* destroy a ** */ #define freepp(type, ptr, len) \ @@ -54,4 +64,4 @@ char * path_strip(char * src); free(ptr); \ } while (0); -#endif /* OUROBOROS_UTILS_H */ +#endif /* OUROBOROS_LIB_UTILS_H */ diff --git a/include/ouroboros/version.h.in b/include/ouroboros/version.h.in index 4306b239..c006a095 100644 --- a/include/ouroboros/version.h.in +++ b/include/ouroboros/version.h.in @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2021 + * Ouroboros - Copyright (C) 2016 - 2024 * * Ouroboros version * |