diff options
author | dimitri staessens <[email protected]> | 2017-04-26 11:17:39 +0000 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2017-04-26 11:17:39 +0000 |
commit | ad522c14994ae19c5a6507ee10ebcacdbf3cf107 (patch) | |
tree | 4e4d3b4f8da805ca9f0f0733977ff678c064660f /include | |
parent | ea16fc664673d65c0e3e51591258be4d3b8be406 (diff) | |
parent | e2c8623e66d66f4b9c8619349d11375a32ac2134 (diff) | |
download | ouroboros-ad522c14994ae19c5a6507ee10ebcacdbf3cf107.tar.gz ouroboros-ad522c14994ae19c5a6507ee10ebcacdbf3cf107.zip |
Merged in dstaesse/ouroboros/be-shm-reserve (pull request #493)
lib: Add call to reserve blocks in rdrbuff
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/ipcp-dev.h | 7 | ||||
-rw-r--r-- | include/ouroboros/shm_du_buff.h | 53 | ||||
-rw-r--r-- | include/ouroboros/shm_rdrbuff.h | 19 |
3 files changed, 59 insertions, 20 deletions
diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h index 571689ca..cdf9f5c1 100644 --- a/include/ouroboros/ipcp-dev.h +++ b/include/ouroboros/ipcp-dev.h @@ -45,9 +45,12 @@ int ipcp_flow_write(int fd, void ipcp_flow_fini(int fd); -void ipcp_flow_del(struct shm_du_buff * sdb); - int ipcp_flow_get_qoscube(int fd, qoscube_t * cube); +int ipcp_sdb_reserve(struct shm_du_buff ** sdb, + size_t len); + +void ipcp_sdb_release(struct shm_du_buff * sdb); + #endif /* OUROBOROS_IPCP_DEV_H */ diff --git a/include/ouroboros/shm_du_buff.h b/include/ouroboros/shm_du_buff.h new file mode 100644 index 00000000..9f796be1 --- /dev/null +++ b/include/ouroboros/shm_du_buff.h @@ -0,0 +1,53 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2017 + * + * Data Buffer element in Random Deletion Ring Buffer + * + * Dimitri Staessens <[email protected]> + * Sander Vrijders <[email protected]> + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef OUROBOROS_SHM_DU_BUFF_H +#define OUROBOROS_SHM_DU_BUFF_H + +#include <sys/types.h> +#include <stdint.h> + +struct shm_du_buff; + +size_t shm_du_buff_get_idx(struct shm_du_buff * sdb); + +uint8_t * shm_du_buff_head(struct shm_du_buff * sdb); + +uint8_t * shm_du_buff_tail(struct shm_du_buff * sdb); + +uint8_t * shm_du_buff_head_alloc(struct shm_du_buff * sdb, + size_t size); + +uint8_t * shm_du_buff_tail_alloc(struct shm_du_buff * sdb, + size_t size); + +void shm_du_buff_head_release(struct shm_du_buff * sdb, + size_t size); + +void shm_du_buff_tail_release(struct shm_du_buff * sdb, + size_t size); + +void shm_du_buff_truncate(struct shm_du_buff * sdb, + size_t len); + +#endif /* OUROBOROS_SHM_DU_BUFF_H */ diff --git a/include/ouroboros/shm_rdrbuff.h b/include/ouroboros/shm_rdrbuff.h index 92173388..13b99eef 100644 --- a/include/ouroboros/shm_rdrbuff.h +++ b/include/ouroboros/shm_rdrbuff.h @@ -24,17 +24,15 @@ #ifndef OUROBOROS_SHM_RDRBUFF_H #define OUROBOROS_SHM_RDRBUFF_H +#include <ouroboros/shm_du_buff.h> #include <ouroboros/shared.h> #include <stdint.h> #include <pthread.h> #include <sys/types.h> -struct shm_du_buff; struct shm_rdrbuff; -size_t shm_du_buff_get_idx(struct shm_du_buff * sdb); - struct shm_rdrbuff * shm_rdrbuff_create(void); struct shm_rdrbuff * shm_rdrbuff_open(void); @@ -68,19 +66,4 @@ struct shm_du_buff * shm_rdrbuff_get(struct shm_rdrbuff * rdrb, int shm_rdrbuff_remove(struct shm_rdrbuff * rdrb, size_t idx); -uint8_t * shm_du_buff_head(struct shm_du_buff * sdb); - -uint8_t * shm_du_buff_tail(struct shm_du_buff * sdb); - -uint8_t * shm_du_buff_head_alloc(struct shm_du_buff * sdb, - size_t size); - -uint8_t * shm_du_buff_tail_alloc(struct shm_du_buff * sdb, - size_t size); - -void shm_du_buff_head_release(struct shm_du_buff * sdb, - size_t size); - -void shm_du_buff_tail_release(struct shm_du_buff * sdb, - size_t size); #endif /* OUROBOROS_SHM_RDRBUFF_H */ |