diff options
| author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-03-04 21:26:43 +0100 |
|---|---|---|
| committer | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-03-07 15:27:04 +0100 |
| commit | 7a4c37e8b673328dda59cec11ab9dce66c22a312 (patch) | |
| tree | d2a05d2fa022d97ba79d8af2d32ec9e7cc3bd9e1 /ffi/pyouroboros_build.py | |
| parent | 62924a033cb2a0130cc6a072e03590f8eec5ac72 (diff) | |
| download | pyouroboros-7a4c37e8b673328dda59cec11ab9dce66c22a312.tar.gz pyouroboros-7a4c37e8b673328dda59cec11ab9dce66c22a312.zip | |
ouroboros: Add IRM wrapper
Add ouroboros.irm module wrapping the Ouroboros IRM C API, providing
Python interfaces for IPCP lifecycle (create, destroy, bootstrap,
enroll, connect), name management (create, destroy, register, list),
and program/process binding.
Split the monolithic CFFI build into separate _ouroboros_dev_cffi and
_ouroboros_irm_cffi modules, each linking only its required library.
Also includes:
- ouroboros.cli module with higher-level wrappers mirroring CLI tools
- FRCT flag support (set/get) in the Flow API
- FlowPeer event type in FEventType
- QoS defaults updated to match ouroboros source
- Bug fixes: flow_set_snd_timeout typo, flow_set_flags calling
convention, FlowSet name mangling, fqueue_type return type
- .gitignore, copyright updates, version bump to 0.23.0
Diffstat (limited to 'ffi/pyouroboros_build.py')
| -rw-r--r-- | ffi/pyouroboros_build.py | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/ffi/pyouroboros_build.py b/ffi/pyouroboros_build.py deleted file mode 100644 index a7a6a0d..0000000 --- a/ffi/pyouroboros_build.py +++ /dev/null @@ -1,137 +0,0 @@ -# -# Ouroboros - Copyright (C) 2016 - 2020 -# -# Python API for applications -# -# Dimitri Staessens <dimitri@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/. -# - -from cffi import FFI - -ffibuilder: FFI = FFI() - -ffibuilder.cdef(""" -/* OUROBOROS QOS.H */ -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 */ - uint32_t timeout; /* Timeout in ms */ -} qosspec_t; - -/* OUROBOROS DEV.H */ -/* Returns flow descriptor, qs updates to supplied QoS. */ -int flow_alloc(const char * dst_name, - qosspec_t * qs, - const struct timespec * timeo); - -/* Returns flow descriptor, qs updates to supplied QoS. */ -int flow_accept(qosspec_t * qs, - const struct timespec * timeo); - -/* Returns flow descriptor, qs updates to supplied QoS. */ -int flow_join(const char * bc, - const struct timespec * timeo); - -int flow_dealloc(int fd); - -ssize_t flow_write(int fd, - const void * buf, - size_t count); - -ssize_t flow_read(int fd, - void * buf, - size_t count); - -/*OUROBOROS FCCNTL.H, VIA WRAPPER */ -int flow_set_snd_timeout(int fd, struct timespec * ts); - -int flow_set_rcv_timeout(int fd, struct timespec * ts); - -int flow_get_snd_timeout(int fd, struct timespec * ts); - -int flow_get_rcv_timeout(int fd, struct timespec * ts); - -int flow_get_qos(int fd, qosspec_t * qs); - -int flow_get_rx_qlen(int fd, size_t * sz); - -int flow_get_tx_qlen(int fd, size_t * sz); - -int flow_set_flags(int fd, uint32_t flags); - -int flow_get_flags(int fd); - -/*OUROBOROS FQUEUE.H */ -enum fqtype { - FLOW_PKT = (1 << 0), - FLOW_DOWN = (1 << 1), - FLOW_UP = (1 << 2), - FLOW_ALLOC = (1 << 3), - FLOW_DEALLOC = (1 << 4) -}; - -struct flow_set; - -struct fqueue; - -typedef struct flow_set fset_t; -typedef struct fqueue fqueue_t; - -fset_t * fset_create(void); - -void fset_destroy(fset_t * set); - -fqueue_t * fqueue_create(void); - -void fqueue_destroy(struct fqueue * fq); - -void fset_zero(fset_t * set); - -int fset_add(fset_t * set, - int fd); - -bool fset_has(const fset_t * set, - int fd); - -void fset_del(fset_t * set, - int fd); - -int fqueue_next(fqueue_t * fq); - -int fqueue_type(fqueue_t * fq); - -ssize_t fevent(fset_t * set, - fqueue_t * fq, - const struct timespec * timeo); -""") - -ffibuilder.set_source("_ouroboros_cffi", - """ -#include "ouroboros/qos.h" -#include "ouroboros/dev.h" -#include "fccntl_wrap.h" -#include "ouroboros/fqueue.h" - """, - libraries=['ouroboros-dev'], - extra_compile_args=["-I./ffi/"]) - -if __name__ == "__main__": - ffibuilder.compile(verbose=True) |
