diff options
author | Dimitri Staessens <[email protected]> | 2022-02-25 17:34:29 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2022-03-03 12:00:54 +0100 |
commit | f5d642a06f9c1a58197313b32f6b213a152e446f (patch) | |
tree | 19ec9813f2d83fae986ff2bddbf5511c5b7662da /include | |
parent | db5e9bf4f884097ec919aa40b02d8eafab05cfa8 (diff) | |
download | ouroboros-f5d642a06f9c1a58197313b32f6b213a152e446f.tar.gz ouroboros-f5d642a06f9c1a58197313b32f6b213a152e446f.zip |
lib: Make flow liveness timeout configurable
The qosspec_t now has a timeout value that sets the timeout value of
the flow. Flows with a peer that has timed out will now return
-EFLOWPEER on flow_read() or flow_write().
Signed-off-by: Dimitri Staessens <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/errno.h | 5 | ||||
-rw-r--r-- | include/ouroboros/fqueue.h | 3 | ||||
-rw-r--r-- | include/ouroboros/qos.h | 52 |
3 files changed, 38 insertions, 22 deletions
diff --git a/include/ouroboros/errno.h b/include/ouroboros/errno.h index 06f33bef..b9f8dbc0 100644 --- a/include/ouroboros/errno.h +++ b/include/ouroboros/errno.h @@ -31,7 +31,8 @@ #define EIPCP 1003 /* Failed to communicate with IPCP */ #define EIPCPSTATE 1004 /* Target in wrong state */ #define EFLOWDOWN 1005 /* Flow is down */ -#define ECRYPT 1006 /* Encryption error */ -#define ENAME 1007 /* Naming error */ +#define EFLOWPEER 1006 /* Flow is down (peer timed out) */ +#define ECRYPT 1007 /* Encryption error */ +#define ENAME 1008 /* Naming error */ #endif /* OUROBOROS_ERRNO_H */ diff --git a/include/ouroboros/fqueue.h b/include/ouroboros/fqueue.h index f6828a4d..3c0ebf90 100644 --- a/include/ouroboros/fqueue.h +++ b/include/ouroboros/fqueue.h @@ -33,7 +33,8 @@ enum fqtype { FLOW_DOWN = (1 << 1), FLOW_UP = (1 << 2), FLOW_ALLOC = (1 << 3), - FLOW_DEALLOC = (1 << 4) + FLOW_DEALLOC = (1 << 4), + FLOW_PEER = (1 << 5) }; struct flow_set; diff --git a/include/ouroboros/qos.h b/include/ouroboros/qos.h index 6391347a..b6b945d9 100644 --- a/include/ouroboros/qos.h +++ b/include/ouroboros/qos.h @@ -26,15 +26,18 @@ #include <stdint.h> #include <stdbool.h> +#define DEFAULT_PEER_TIMEOUT 120000 + 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 */ - uint16_t cypher_s; /* Cypher strength, 0 = no encryption */ + 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. */ + uint16_t cypher_s; /* Cypher strength (bits), 0 = no encryption. */ + uint32_t timeout; /* Peer timeout time, in ms, 0 = no timeout. */ } qosspec_t; static const qosspec_t qos_raw = { @@ -45,7 +48,8 @@ static const qosspec_t qos_raw = { .ber = 1, .in_order = 0, .max_gap = UINT32_MAX, - .cypher_s = 0 + .cypher_s = 0, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_raw_no_errors = { @@ -56,7 +60,8 @@ static const qosspec_t qos_raw_no_errors = { .ber = 0, .in_order = 0, .max_gap = UINT32_MAX, - .cypher_s = 0 + .cypher_s = 0, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_raw_crypt = { @@ -67,7 +72,8 @@ static const qosspec_t qos_raw_crypt = { .ber = 0, .in_order = 0, .max_gap = UINT32_MAX, - .cypher_s = 256 + .cypher_s = 256, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_best_effort = { @@ -78,7 +84,8 @@ static const qosspec_t qos_best_effort = { .ber = 0, .in_order = 1, .max_gap = UINT32_MAX, - .cypher_s = 0 + .cypher_s = 0, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_best_effort_crypt = { @@ -89,7 +96,8 @@ static const qosspec_t qos_best_effort_crypt = { .ber = 0, .in_order = 1, .max_gap = UINT32_MAX, - .cypher_s = 256 + .cypher_s = 256, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_video = { @@ -100,7 +108,8 @@ static const qosspec_t qos_video = { .ber = 0, .in_order = 1, .max_gap = 100, - .cypher_s = 0 + .cypher_s = 0, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_video_crypt = { @@ -111,7 +120,8 @@ static const qosspec_t qos_video_crypt = { .ber = 0, .in_order = 1, .max_gap = 100, - .cypher_s = 256 + .cypher_s = 256, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_voice = { @@ -122,7 +132,8 @@ static const qosspec_t qos_voice = { .ber = 0, .in_order = 1, .max_gap = 50, - .cypher_s = 0 + .cypher_s = 0, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_voice_crypt = { @@ -133,7 +144,8 @@ static const qosspec_t qos_voice_crypt = { .ber = 0, .in_order = 1, .max_gap = 50, - .cypher_s = 256 + .cypher_s = 256, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_data = { @@ -144,7 +156,8 @@ static const qosspec_t qos_data = { .ber = 0, .in_order = 1, .max_gap = 2000, - .cypher_s = 0 + .cypher_s = 0, + .timeout = DEFAULT_PEER_TIMEOUT }; static const qosspec_t qos_data_crypt = { @@ -155,7 +168,8 @@ static const qosspec_t qos_data_crypt = { .ber = 0, .in_order = 1, .max_gap = 2000, - .cypher_s = 256 + .cypher_s = 256, + .timeout = DEFAULT_PEER_TIMEOUT }; #endif /* OUROBOROS_QOS_H */ |