diff options
| author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-06-30 18:55:39 +0200 |
|---|---|---|
| committer | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-06-30 19:03:01 +0200 |
| commit | 87596aa6b7647f618ee8e7981d8e946f8edfa33e (patch) | |
| tree | 643889072324dd13d06a35013ec2ddd8afe0bff4 | |
| parent | d84a1b2f9e8ccc4b19cfb90b5a11d4be2ef34479 (diff) | |
| download | pyouroboros-87596aa6b7647f618ee8e7981d8e946f8edfa33e.tar.gz pyouroboros-87596aa6b7647f618ee8e7981d8e946f8edfa33e.zip | |
ffi: Add fccntl wrapper and update headers
| -rw-r--r-- | ffi/fccntl_wrap.h | 35 | ||||
| -rw-r--r-- | ffi/irm_wrap.h | 43 | ||||
| -rw-r--r-- | ffi/pyouroboros_build_dev.py | 21 | ||||
| -rw-r--r-- | ffi/pyouroboros_build_irm.py | 13 |
4 files changed, 64 insertions, 48 deletions
diff --git a/ffi/fccntl_wrap.h b/ffi/fccntl_wrap.h index f9a137e..0555e24 100644 --- a/ffi/fccntl_wrap.h +++ b/ffi/fccntl_wrap.h @@ -57,6 +57,11 @@ int flow_get_tx_qlen(int fd, size_t * sz) return fccntl(fd, FLOWGTXQLEN, sz); } +int flow_get_mtu(int fd, size_t * mtu) +{ + return fccntl(fd, FLOWGMTU, mtu); +} + int flow_set_flags(int fd, uint32_t flags) { return fccntl(fd, FLOWSFLAGS, flags); @@ -86,3 +91,33 @@ int flow_get_frct_flags(int fd) return (int) flags; } + +int flow_set_frct_max_sdu(int fd, size_t max) +{ + return fccntl(fd, FRCTSMAXSDU, max); +} + +int flow_get_frct_max_sdu(int fd, size_t * max) +{ + return fccntl(fd, FRCTGMAXSDU, max); +} + +int flow_set_frct_rcv_ring_sz(int fd, size_t sz) +{ + return fccntl(fd, FRCTSRRINGSZ, sz); +} + +int flow_get_frct_rcv_ring_sz(int fd, size_t * sz) +{ + return fccntl(fd, FRCTGRRINGSZ, sz); +} + +int flow_set_frct_rto_min(int fd, time_t rto_ns) +{ + return fccntl(fd, FRCTSRTOMIN, rto_ns); +} + +int flow_get_frct_rto_min(int fd, time_t * rto_ns) +{ + return fccntl(fd, FRCTGRTOMIN, rto_ns); +} diff --git a/ffi/irm_wrap.h b/ffi/irm_wrap.h index 23b64a0..9e5ff91 100644 --- a/ffi/irm_wrap.h +++ b/ffi/irm_wrap.h @@ -21,8 +21,6 @@ #include <ouroboros/irm.h> #include <arpa/inet.h> -#include <string.h> -#include <stdlib.h> static int ipcp_config_udp4_set_ip(struct ipcp_config * conf, const char * ip_str) @@ -47,44 +45,3 @@ static int ipcp_config_udp6_set_dns(struct ipcp_config * conf, { return inet_pton(AF_INET6, dns_str, &conf->udp6.dns_addr) == 1 ? 0 : -1; } - -static void ipcp_config_init_uni(struct ipcp_config * conf, - uint8_t addr_size, uint8_t eid_size, - uint8_t max_ttl, - enum pol_link_state ls_pol, - long t_recalc, long t_update, long t_timeo, - enum pol_dir dir_pol, - uint32_t dht_alpha, uint32_t dht_k, - uint32_t dht_t_expire, uint32_t dht_t_refresh, - uint32_t dht_t_replicate, - enum pol_addr_auth addr_auth, - enum pol_cong_avoid cong_avoid) -{ - memset(conf, 0, sizeof(*conf)); - conf->type = IPCP_UNICAST; - conf->unicast.dt.addr_size = addr_size; - conf->unicast.dt.eid_size = eid_size; - conf->unicast.dt.max_ttl = max_ttl; - conf->unicast.dt.routing.pol = ROUTING_LINK_STATE; - conf->unicast.dt.routing.ls.pol = ls_pol; - conf->unicast.dt.routing.ls.t_recalc = t_recalc; - conf->unicast.dt.routing.ls.t_update = t_update; - conf->unicast.dt.routing.ls.t_timeo = t_timeo; - conf->unicast.dir.pol = dir_pol; - conf->unicast.dir.dht.params.alpha = dht_alpha; - conf->unicast.dir.dht.params.k = dht_k; - conf->unicast.dir.dht.params.t_expire = dht_t_expire; - conf->unicast.dir.dht.params.t_refresh = dht_t_refresh; - conf->unicast.dir.dht.params.t_replicate = dht_t_replicate; - conf->unicast.addr_auth_type = addr_auth; - conf->unicast.cong_avoid = cong_avoid; -} - -static void ipcp_config_init_eth(struct ipcp_config * conf, - const char * dev, - uint16_t ethertype) -{ - memset(conf, 0, sizeof(*conf)); - strncpy(conf->eth.dev, dev, DEV_NAME_SIZE); - conf->eth.ethertype = ethertype; -} diff --git a/ffi/pyouroboros_build_dev.py b/ffi/pyouroboros_build_dev.py index 778cc40..d32d577 100644 --- a/ffi/pyouroboros_build_dev.py +++ b/ffi/pyouroboros_build_dev.py @@ -19,6 +19,11 @@ # Foundation, Inc., http://www.fsf.org/about/contact/. # +"""CFFI build script for the ouroboros-dev library.""" + +# qosspec_t / timespec cdef is duplicated in the irm builder per CFFI module. +# pylint: disable=duplicate-code + from cffi import FFI ffibuilder: FFI = FFI() @@ -40,12 +45,12 @@ struct timespec { /* OUROBOROS QOS.H */ typedef struct qos_spec { + uint8_t service; uint32_t delay; uint64_t bandwidth; uint8_t availability; uint32_t loss; uint32_t ber; - uint8_t in_order; uint32_t max_gap; uint32_t timeout; /* Timeout in ms */ } qosspec_t; @@ -89,6 +94,8 @@ int flow_get_rx_qlen(int fd, size_t * sz); int flow_get_tx_qlen(int fd, size_t * sz); +int flow_get_mtu(int fd, size_t * mtu); + int flow_set_flags(int fd, uint32_t flags); int flow_get_flags(int fd); @@ -97,6 +104,18 @@ int flow_set_frct_flags(int fd, uint16_t flags); int flow_get_frct_flags(int fd); +int flow_set_frct_max_sdu(int fd, size_t max); + +int flow_get_frct_max_sdu(int fd, size_t * max); + +int flow_set_frct_rcv_ring_sz(int fd, size_t sz); + +int flow_get_frct_rcv_ring_sz(int fd, size_t * sz); + +int flow_set_frct_rto_min(int fd, time_t rto_ns); + +int flow_get_frct_rto_min(int fd, time_t * rto_ns); + /* OUROBOROS FQUEUE.H */ enum fqtype { FLOW_PKT = ..., diff --git a/ffi/pyouroboros_build_irm.py b/ffi/pyouroboros_build_irm.py index 1fc515e..70056b1 100644 --- a/ffi/pyouroboros_build_irm.py +++ b/ffi/pyouroboros_build_irm.py @@ -19,6 +19,11 @@ # Foundation, Inc., http://www.fsf.org/about/contact/. # +"""CFFI build script for the ouroboros-irm library.""" + +# qosspec_t / timespec cdef is duplicated in the dev builder per CFFI module. +# pylint: disable=duplicate-code + from cffi import FFI ffibuilder: FFI = FFI() @@ -45,12 +50,12 @@ struct in6_addr { ...; }; /* OUROBOROS QOS.H */ typedef struct qos_spec { + uint8_t service; uint32_t delay; uint64_t bandwidth; uint8_t availability; uint32_t loss; uint32_t ber; - uint8_t in_order; uint32_t max_gap; uint32_t timeout; /* Timeout in ms */ } qosspec_t; @@ -232,13 +237,13 @@ int irm_bootstrap_ipcp(pid_t pid, const struct ipcp_config * conf); int irm_connect_ipcp(pid_t pid, - const char * component, const char * dst, + const char * component, qosspec_t qs); int irm_disconnect_ipcp(pid_t pid, - const char * component, - const char * dst); + const char * dst, + const char * component); int irm_bind_program(const char * prog, const char * name, |
