diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/ouroboros/frct_pci.h | 69 | ||||
| -rw-r--r-- | include/ouroboros/hash.h | 8 | ||||
| -rw-r--r-- | include/ouroboros/shm_flow_set.h | 2 | ||||
| -rw-r--r-- | include/ouroboros/shm_rbuff.h | 2 | ||||
| -rw-r--r-- | include/ouroboros/timerwheel.h | 45 | 
5 files changed, 123 insertions, 3 deletions
diff --git a/include/ouroboros/frct_pci.h b/include/ouroboros/frct_pci.h new file mode 100644 index 00000000..3a93ac1c --- /dev/null +++ b/include/ouroboros/frct_pci.h @@ -0,0 +1,69 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2017 + * + * Protocol Control Information of FRCT + * + *    Dimitri Staessens <dimitri.staessens@ugent.be> + *    Sander Vrijders   <sander.vrijders@ugent.be> + * + * 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_FRCT_PCI_H +#define OUROBOROS_LIB_FRCT_PCI_H + +#include <ouroboros/shm_du_buff.h> + +#include <stdint.h> +#include <stdbool.h> + +struct frct_pci { +        uint8_t  type; +        uint8_t  flags; +        uint64_t seqno; +        uint64_t lwe; +        uint64_t rwe; +}; + +enum pdu_types { +        PDU_TYPE_DATA        = 0x01, +        PDU_TYPE_ACK         = 0x02, +        PDU_TYPE_FC          = 0x04, +        PDU_TYPE_ACK_AND_FC  = (PDU_TYPE_ACK | PDU_TYPE_FC), +        PDU_TYPE_CONFIG      = 0x08, +        PDU_TYPE_RENDEZ_VOUS = 0x10 +}; + +enum config_flags { +        CONF_RESOURCE_CONTROL = 0x01, +        CONF_RELIABLE         = 0x02, +        CONF_ERROR_CHECK      = 0x04, +        CONF_ORDERED          = 0x08, +        CONF_PARTIAL          = 0x10 +}; + +enum data_flags { +        FLAG_DATA_RUN       = 0x01, +        FLAG_MORE_FRAGMENTS = 0x02 +}; + +int frct_pci_ser(struct shm_du_buff * sdb, +                 struct frct_pci *    pci, +                 bool                 error_check); + +int frct_pci_des(struct shm_du_buff * sdb, +                 struct frct_pci *    pci, +                 bool                 error_check); + +#endif /* OUROBOROS_LIB_FRCT_PCI_H */ diff --git a/include/ouroboros/hash.h b/include/ouroboros/hash.h index db47c9fe..49160226 100644 --- a/include/ouroboros/hash.h +++ b/include/ouroboros/hash.h @@ -29,6 +29,7 @@  #include <gcrypt.h>  #endif  #include <stdint.h> +#include <stddef.h>  /* Hash algorithms */  enum hash_algo { @@ -58,8 +59,13 @@ enum hash_algo {  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 str_hash(enum hash_algo algo, -              void *         buf, +              void *         dst,                const char *   str);  #endif /* OUROBOROS_LIB_HASH_H */ diff --git a/include/ouroboros/shm_flow_set.h b/include/ouroboros/shm_flow_set.h index 5c498336..be2f836b 100644 --- a/include/ouroboros/shm_flow_set.h +++ b/include/ouroboros/shm_flow_set.h @@ -58,6 +58,6 @@ 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, -                                        const struct timespec *     timeout); +                                        const struct timespec *     abstime);  #endif /* OUROBOROS_SHM_FLOW_SET_H */ diff --git a/include/ouroboros/shm_rbuff.h b/include/ouroboros/shm_rbuff.h index 1557e50c..55d03b41 100644 --- a/include/ouroboros/shm_rbuff.h +++ b/include/ouroboros/shm_rbuff.h @@ -50,7 +50,7 @@ int                shm_rbuff_write(struct shm_rbuff * rb,  ssize_t            shm_rbuff_read(struct shm_rbuff * rb);  ssize_t            shm_rbuff_read_b(struct shm_rbuff *      rb, -                                    const struct timespec * timeout); +                                    const struct timespec * abstime);  size_t             shm_rbuff_queued(struct shm_rbuff * rb); diff --git a/include/ouroboros/timerwheel.h b/include/ouroboros/timerwheel.h new file mode 100644 index 00000000..e259c855 --- /dev/null +++ b/include/ouroboros/timerwheel.h @@ -0,0 +1,45 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2017 + * + * Ring buffer for incoming SDUs + * + *    Dimitri Staessens <dimitri.staessens@ugent.be> + *    Sander Vrijders   <sander.vrijders@ugent.be> + * + * 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_TIMERWHEEL_H +#define OUROBOROS_LIB_TIMERWHEEL_H + +struct timerwheel; + +struct timerwheel * timerwheel_create(time_t resolution, +                                      time_t max_delay); + +void                timerwheel_destroy(struct timerwheel * tw); + +struct tw_f *       timerwheel_start(struct timerwheel * tw, +                                     void (* func)(void *), +                                     void *              arg, +                                     time_t              delay); /* ms */ + +int                 timerwheel_restart(struct timerwheel * tw, +                                       struct tw_f *       f, +                                       time_t              delay); /* ms */ + +void                timerwheel_stop(struct timerwheel * tw, +                                    struct tw_f *       f); + +#endif /* OUROBOROS_LIB_TIMERWHEEL_H */  | 
