summaryrefslogtreecommitdiff
path: root/src/lib/sockets.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-10-04 18:06:32 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2018-10-05 09:07:47 +0200
commitb802b25ddfe6f1b6ecabe3ba70e3dac2e99e7a50 (patch)
tree94e787f0f0ca1f0254b3728b0156b2e3283d8518 /src/lib/sockets.c
parent937adca2a718b160b6d42bb8a3f28d96321fdb49 (diff)
downloadouroboros-b802b25ddfe6f1b6ecabe3ba70e3dac2e99e7a50.tar.gz
ouroboros-b802b25ddfe6f1b6ecabe3ba70e3dac2e99e7a50.zip
lib: Pass qosspec at flow allocation
The flow allocator now passes the full qos specification to the endpoint, instead of just a cube. This is a more flexible architecture, as it makes QoS cubes internal to the layers. Adds endianness transforms for the flow allocator protocol in the normal IPCP. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/lib/sockets.c')
-rw-r--r--src/lib/sockets.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/lib/sockets.c b/src/lib/sockets.c
index b148b7ca..85726783 100644
--- a/src/lib/sockets.c
+++ b/src/lib/sockets.c
@@ -165,3 +165,38 @@ char * ipcp_sock_path(pid_t pid)
return full_name;
}
+
+qosspec_msg_t spec_to_msg(qosspec_t * qs)
+{
+ qosspec_t spec;
+ qosspec_msg_t msg = QOSSPEC_MSG__INIT;
+
+ spec = (qs == NULL ? qos_raw : *qs);
+
+ msg.delay = spec.delay;
+ msg.bandwidth = spec.bandwidth;
+ msg.availability = spec.availability;
+ msg.loss = spec.loss;
+ msg.ber = spec.ber;
+ msg.in_order = spec.in_order;
+ msg.max_gap = spec.max_gap;
+
+ return msg;
+}
+
+qosspec_t msg_to_spec(qosspec_msg_t * msg)
+{
+ qosspec_t spec;
+
+ assert(msg);
+
+ spec.delay = msg->delay;
+ spec.bandwidth = msg->bandwidth;
+ spec.availability = msg->availability;
+ spec.loss = msg->loss;
+ spec.ber = msg->ber;
+ spec.in_order = msg->in_order;
+ spec.max_gap = msg->max_gap;
+
+ return spec;
+}