aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--ffi/pyouroboros_build.py3
-rw-r--r--ouroboros/dev.py22
-rw-r--r--ouroboros/qos.py10
-rwxr-xr-xsetup.py2
5 files changed, 18 insertions, 25 deletions
diff --git a/README.md b/README.md
index dec2db5..36c3613 100644
--- a/README.md
+++ b/README.md
@@ -83,12 +83,12 @@ You can specify a QoSSpec for flow allocation.
For instance,
```Python
-qos = QoSSpec(loss=0, cypher_s=256)
+qos = QoSSpec(loss=0, timeout=60000)
f = flow_alloc("name", qos)
```
-will create a new flow with FRCP retransmission enabled and encrypted
-using a 256-bit ECDHE-AES-SHA3 cypher.
+will create a new flow with FRCP retransmission enabled that will
+timeout if the peer is not responsive for 1 minute.
## Manipulating flows
diff --git a/ffi/pyouroboros_build.py b/ffi/pyouroboros_build.py
index b4ace8e..a7a6a0d 100644
--- a/ffi/pyouroboros_build.py
+++ b/ffi/pyouroboros_build.py
@@ -33,7 +33,7 @@ typedef struct qos_spec {
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 timeout; /* Timeout in ms */
} qosspec_t;
/* OUROBOROS DEV.H */
@@ -48,7 +48,6 @@ int flow_accept(qosspec_t * qs,
/* Returns flow descriptor, qs updates to supplied QoS. */
int flow_join(const char * bc,
- qosspec_t * qs,
const struct timespec * timeo);
int flow_dealloc(int fd);
diff --git a/ouroboros/dev.py b/ouroboros/dev.py
index 7d29624..bc5d133 100644
--- a/ouroboros/dev.py
+++ b/ouroboros/dev.py
@@ -19,15 +19,16 @@
# Foundation, Inc., http://www.fsf.org/about/contact/.
#
-from _ouroboros_cffi import ffi, lib
import errno
from enum import IntFlag
+
+from _ouroboros_cffi import ffi, lib
from ouroboros.qos import *
from ouroboros.qos import _qos_to_qosspec, _fl_to_timespec, _qosspec_to_qos, _timespec_to_fl
# Some constants
-MILLION = 1000 * 1000
-BILLION = 1000 * 1000 * 1000
+MILLION = 1000_1000
+BILLION = 1000_1000_1000
# ouroboros exceptions
@@ -143,8 +144,7 @@ class Flow:
def join(self,
dst: str,
- qos: QoSSpec = None,
- timeo: float = None) -> Optional[QoSSpec]:
+ timeo: float = None) -> None:
"""
Join a broadcast layer
@@ -157,16 +157,12 @@ class Flow:
if self.__fd >= 0:
raise FlowAllocatedException()
- _qos = _qos_to_qosspec(qos)
-
_timeo = _fl_to_timespec(timeo)
- self.__fd = lib.flow_join(dst.encode(), _qos, _timeo)
+ self.__fd = lib.flow_join(dst.encode(), _timeo)
_raise(self.__fd)
- return _qosspec_to_qos(_qos)
-
def dealloc(self):
"""
Deallocate a flow
@@ -196,8 +192,8 @@ class Flow:
if count is None:
return lib.flow_write(self.__fd, ffi.from_buffer(buf), len(buf))
- else:
- return lib.flow_write(self.__fd, ffi.from_buffer(buf), count)
+
+ return lib.flow_write(self.__fd, ffi.from_buffer(buf), count)
def writeline(self,
ln: str) -> int:
@@ -394,5 +390,3 @@ def flow_join(dst: str,
f = Flow()
f.join(dst, qos, timeo)
return f
-
-
diff --git a/ouroboros/qos.py b/ouroboros/qos.py
index f437ee2..a43d87d 100644
--- a/ouroboros/qos.py
+++ b/ouroboros/qos.py
@@ -37,7 +37,7 @@ class QoSSpec:
ber: Bit error rate, errors per billion bits. default BILLION
in_order: In-order delivery, enables FRCT, default 0
max_gap: Maximum interruption in ms, default MILLION
- cypher_s: Requested encryption strength in bits
+ timeout: Peer timeout (ms), default 120000 (2 minutes)
"""
def __init__(self,
@@ -48,7 +48,7 @@ class QoSSpec:
ber: int = MILLION,
in_order: int = 0,
max_gap: int = MILLION,
- cypher_s: int = 0):
+ timeout: int = 120000):
self.delay = delay
self.bandwidth = bandwidth
self.availability = availability
@@ -56,7 +56,7 @@ class QoSSpec:
self.ber = ber
self.in_order = in_order
self.max_gap = max_gap
- self.cypher_s = cypher_s
+ self.timeout = timeout
def _fl_to_timespec(timeo: float):
@@ -93,7 +93,7 @@ def _qos_to_qosspec(qos: QoSSpec):
qos.ber,
qos.in_order,
qos.max_gap,
- qos.cypher_s])
+ qos.timeout])
def _qosspec_to_qos(_qos) -> Optional[QoSSpec]:
@@ -107,4 +107,4 @@ def _qosspec_to_qos(_qos) -> Optional[QoSSpec]:
ber=_qos.ber,
in_order=_qos.in_order,
max_gap=_qos.max_gap,
- cypher_s=_qos.cypher_s)
+ timeout=_qos.timeout)
diff --git a/setup.py b/setup.py
index 023f3b4..876f782 100755
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ import setuptools
setuptools.setup(
name='PyOuroboros',
- version=0.17,
+ version=0.19,
url='https://ouroboros.rocks',
keywords='ouroboros IPC subsystem',
author='Dimitri Staessens',