diff options
author | Sander Vrijders <[email protected]> | 2017-01-03 13:43:40 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2017-01-03 13:43:40 +0100 |
commit | 004b586fd6b381fd1292aa276342163123be560a (patch) | |
tree | 4734c9872a5b9b4b4cb12e9fab82bdb255a6591a /src/ipcpd/shim-udp | |
parent | 4ccd3e2c8af00963ac6d88aac587de016300ed90 (diff) | |
parent | 5ab96126078cb9166356beaff3458404664274ed (diff) | |
download | ouroboros-004b586fd6b381fd1292aa276342163123be560a.tar.gz ouroboros-004b586fd6b381fd1292aa276342163123be560a.zip |
Merged in dstaesse/ouroboros/be-qos (pull request #332)
lib, ipcpd, irmd: Proof of concept QoS
Diffstat (limited to 'src/ipcpd/shim-udp')
-rw-r--r-- | src/ipcpd/shim-udp/main.c | 32 | ||||
-rw-r--r-- | src/ipcpd/shim-udp/shim_udp_messages.proto | 17 |
2 files changed, 29 insertions, 20 deletions
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index cdd02c49..12f586f0 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -196,10 +196,11 @@ static int send_shim_udp_msg(shim_udp_msg_t * msg, uint32_t dst_ip_addr) return 0; } -static int ipcp_udp_port_alloc(uint32_t dst_ip_addr, - uint16_t src_udp_port, - char * dst_name, - char * src_ae_name) +static int ipcp_udp_port_alloc(uint32_t dst_ip_addr, + uint16_t src_udp_port, + char * dst_name, + char * src_ae_name, + qoscube_t cube) { shim_udp_msg_t msg = SHIM_UDP_MSG__INIT; @@ -207,6 +208,8 @@ static int ipcp_udp_port_alloc(uint32_t dst_ip_addr, msg.src_udp_port = src_udp_port; msg.dst_name = dst_name; msg.src_ae_name = src_ae_name; + msg.has_qoscube = true; + msg.qoscube = cube; return send_shim_udp_msg(&msg, dst_ip_addr); } @@ -229,8 +232,9 @@ static int ipcp_udp_port_alloc_resp(uint32_t dst_ip_addr, } static int ipcp_udp_port_req(struct sockaddr_in * c_saddr, - char * dst_name, - char * src_ae_name) + char * dst_name, + char * src_ae_name, + qoscube_t cube) { int skfd; int fd; @@ -273,7 +277,7 @@ static int ipcp_udp_port_req(struct sockaddr_in * c_saddr, pthread_rwlock_wrlock(&udp_data.flows_lock); /* reply to IRM */ - fd = ipcp_flow_req_arr(getpid(), dst_name, src_ae_name); + fd = ipcp_flow_req_arr(getpid(), dst_name, src_ae_name, cube); if (fd < 0) { pthread_rwlock_unlock(&udp_data.flows_lock); pthread_rwlock_unlock(&ipcpi.state_lock); @@ -395,7 +399,8 @@ static void * ipcp_udp_listener(void * o) c_saddr.sin_port = msg->src_udp_port; ipcp_udp_port_req(&c_saddr, msg->dst_name, - msg->src_ae_name); + msg->src_ae_name, + msg->qoscube); break; case SHIM_UDP_MSG_CODE__FLOW_REPLY: ipcp_udp_port_alloc_reply(msg->src_udp_port, @@ -947,7 +952,7 @@ static int ipcp_udp_name_query(char * name) static int ipcp_udp_flow_alloc(int fd, char * dst_name, char * src_ae_name, - qoscube_t qos) + qoscube_t cube) { struct sockaddr_in r_saddr; /* server address */ struct sockaddr_in f_saddr; /* flow */ @@ -966,8 +971,10 @@ static int ipcp_udp_flow_alloc(int fd, return -1; } - if (qos != QOS_CUBE_BE) - LOG_DBG("QoS requested. UDP/IP can't do that."); + if (cube != QOS_CUBE_BE && cube != QOS_CUBE_FRC) { + LOG_DBG("Unsupported QoS requested."); + return -1; + } skfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); @@ -1030,7 +1037,8 @@ static int ipcp_udp_flow_alloc(int fd, if (ipcp_udp_port_alloc(ip_addr, f_saddr.sin_port, dst_name, - src_ae_name) < 0) { + src_ae_name, + cube) < 0) { pthread_rwlock_rdlock(&ipcpi.state_lock); pthread_rwlock_wrlock(&udp_data.flows_lock); diff --git a/src/ipcpd/shim-udp/shim_udp_messages.proto b/src/ipcpd/shim-udp/shim_udp_messages.proto index f5a23b82..cc535a60 100644 --- a/src/ipcpd/shim-udp/shim_udp_messages.proto +++ b/src/ipcpd/shim-udp/shim_udp_messages.proto @@ -23,15 +23,16 @@ syntax = "proto2"; enum shim_udp_msg_code { - FLOW_REQ = 1; - FLOW_REPLY = 2; + FLOW_REQ = 1; + FLOW_REPLY = 2; }; message shim_udp_msg { - required shim_udp_msg_code code = 1; - optional string dst_name = 2; - optional string src_ae_name = 4; - required uint32 src_udp_port = 5; - optional uint32 dst_udp_port = 6; - optional sint32 response = 7; + required shim_udp_msg_code code = 1; + optional string dst_name = 2; + optional string src_ae_name = 4; + required uint32 src_udp_port = 5; + optional uint32 dst_udp_port = 6; + optional uint32 qoscube = 7; + optional sint32 response = 8; }; |