summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-05-14 21:59:46 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-05-14 21:59:46 +0200
commit1712f5d78567bbad7a0608fb1428be000a83fe4a (patch)
tree0831f200a4e2d38d68393a4bccfbd2d5c48d2586
parent43228f68f8e577015fe8116ab145fcc45ab789e7 (diff)
parent8f1e46eab45ba0f497f05d6fe18fb83d8590b3e9 (diff)
downloadouroboros-1712f5d78567bbad7a0608fb1428be000a83fe4a.tar.gz
ouroboros-1712f5d78567bbad7a0608fb1428be000a83fe4a.zip
Merged in sandervrijders/ouroboros/be (pull request #84)
lib, ipcpd, irmd: Add QoS cube definition
-rw-r--r--include/ouroboros/CMakeLists.txt15
-rw-r--r--include/ouroboros/cdap.h37
-rw-r--r--include/ouroboros/common.h11
-rw-r--r--include/ouroboros/da.h4
-rw-r--r--include/ouroboros/dev.h9
-rw-r--r--include/ouroboros/dif_config.h4
-rw-r--r--include/ouroboros/flow.h4
-rw-r--r--include/ouroboros/instance_name.h4
-rw-r--r--include/ouroboros/ipcp.h22
-rw-r--r--include/ouroboros/qos.h35
-rw-r--r--src/ipcpd/flow.c7
-rw-r--r--src/ipcpd/flow.h31
-rw-r--r--src/ipcpd/ipcp-ops.h14
-rw-r--r--src/ipcpd/ipcp.c2
-rw-r--r--src/ipcpd/normal/CMakeLists.txt6
-rw-r--r--src/ipcpd/shim-udp/main.c15
-rw-r--r--src/irmd/main.c13
-rw-r--r--src/lib/CMakeLists.txt3
-rw-r--r--src/lib/ipcp.c32
-rw-r--r--src/lib/ipcpd_messages.proto11
20 files changed, 144 insertions, 135 deletions
diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt
index f1276f51..6e49ee04 100644
--- a/include/ouroboros/CMakeLists.txt
+++ b/include/ouroboros/CMakeLists.txt
@@ -3,25 +3,14 @@ configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/config.h")
set(HEADER_FILES
- bitmap.h
cdap.h
- common.h
da.h
dev.h
dif_config.h
- du_buff.h
flow.h
instance_name.h
- ipcp.h
irm.h
- list.h
- logs.h
- rw_lock.h
- shm_ap_rbuff.h
- shm_du_map.h
- sockets.h
- utils.h
+ qos.h
)
-install(FILES ${HEADER_FILES} "${CMAKE_CURRENT_BINARY_DIR}/config.h"
- DESTINATION include/ouroboros)
+install(FILES ${HEADER_FILES} DESTINATION include/ouroboros)
diff --git a/include/ouroboros/cdap.h b/include/ouroboros/cdap.h
index f1abeff5..72788ad6 100644
--- a/include/ouroboros/cdap.h
+++ b/include/ouroboros/cdap.h
@@ -23,81 +23,80 @@
#ifndef OUROBOROS_CDAP_H
#define OUROBOROS_CDAP_H
-#include "common.h"
#include <stdbool.h>
struct cdap;
struct cdap_ops {
/* Sender related callbacks */
- int (* handle_connect_r)(port_id_t id,
+ int (* handle_connect_r)(int fd,
int invoke_id,
int result);
- int (* handle_release_r)(port_id_t id,
+ int (* handle_release_r)(int fd,
int invoke_id,
int result);
- int (* handle_read_r)(port_id_t id,
+ int (* handle_read_r)(int fd,
int invoke_id,
int result,
char * reason,
char * obj_val,
bool complete);
- int (* handle_cancelread_r)(port_id_t id,
+ int (* handle_cancelread_r)(int fd,
int invoke_id,
int result);
- int (* handle_write_r)(port_id_t id,
+ int (* handle_write_r)(int fd,
int invoke_id,
int result,
char * reason,
char * obj_val);
- int (* handle_create_r)(port_id_t id,
+ int (* handle_create_r)(int fd,
int invoke_id,
int result);
- int (* handle_delete_r)(port_id_t id,
+ int (* handle_delete_r)(int fd,
int invoke_id,
int result);
- int (* handle_start_r)(port_id_t id,
+ int (* handle_start_r)(int fd,
int invoke_id,
int result);
- int (* handle_stop_r)(port_id_t id,
+ int (* handle_stop_r)(int fd,
int invoke_id,
int result);
/* Receiver related callbacks */
- int (* handle_connect)(port_id_t id,
+ int (* handle_connect)(int fd,
int invoke_id,
rina_name_t src,
rina_name_t dst,
char * auth_mech,
char * auth_val);
- int (* handle_release)(port_id_t id,
+ int (* handle_release)(int fd,
int invoke_id);
- int (* handle_cancelread)(port_id_t id,
+ int (* handle_cancelread)(int fd,
int invoke_id);
- int (* handle_write)(port_id_t id,
+ int (* handle_write)(int fd,
int invoke_id,
char * obj_name,
char * obj_val);
- int (* handle_create)(port_id_t id,
+ int (* handle_create)(int fd,
int invoke_id,
char * obj_class,
char * obj_name,
char * obj_val);
- int (* handle_delete)(port_id_t id,
+ int (* handle_delete)(int fd,
int invoke_id,
char * obj_name);
- int (* handle_start)(port_id_t id,
+ int (* handle_start)(int fd,
int invoke_id,
char * obj_name,
char * obj_val);
- int (* handle_stop)(port_id_t id,
+ int (* handle_stop)(int fd,
int invoke_id,
char * obj_name,
char * obj_val);
};
struct cdap * cdap_create(struct cdap_ops ops,
- port_id_t id);
+ int fd);
int cdap_destroy(struct cdap * instance);
/* Sender related functions */
diff --git a/include/ouroboros/common.h b/include/ouroboros/common.h
index 971a382a..f2c8a9ec 100644
--- a/include/ouroboros/common.h
+++ b/include/ouroboros/common.h
@@ -33,13 +33,10 @@ typedef struct {
size_t size;
} buffer_t;
-/* FIXME: may need revision */
-struct qos_spec {
- char * qos_name;
- char * dif_name;
-
- uint32_t delay;
- uint32_t jitter;
+/* FIXME: To be decided which QoS cubes we support */
+enum qos_cube {
+ QOS_CUBE_BE = 0,
+ QOS_CUBE_VIDEO
};
#endif /* OUROBOROS_COMMON_H */
diff --git a/include/ouroboros/da.h b/include/ouroboros/da.h
index 9ecd4bd8..406be7a8 100644
--- a/include/ouroboros/da.h
+++ b/include/ouroboros/da.h
@@ -23,8 +23,8 @@
#ifndef OUROBOROS_DA_H
#define OUROBOROS_DA_H
-#include "common.h"
-#include "instance_name.h"
+#include <stdint.h>
+#include <unistd.h>
char * da_resolve_daf(char * daf_name);
/*
diff --git a/include/ouroboros/dev.h b/include/ouroboros/dev.h
index d8e65144..506fa789 100644
--- a/include/ouroboros/dev.h
+++ b/include/ouroboros/dev.h
@@ -20,12 +20,15 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef OUROBOROS_DEV_H
-#define OUROBOROS_DEV_H
+#include <unistd.h>
+#include <stdint.h>
-#include <ouroboros/common.h>
+#include <ouroboros/qos.h>
#include <ouroboros/flow.h>
+#ifndef OUROBOROS_DEV_H
+#define OUROBOROS_DEV_H
+
#define UNKNOWN_AP "__UNKNOWN_AP__"
#define UNKNOWN_AE "__UNKNOWN_AE__"
diff --git a/include/ouroboros/dif_config.h b/include/ouroboros/dif_config.h
index 5d489b0c..d76d4f68 100644
--- a/include/ouroboros/dif_config.h
+++ b/include/ouroboros/dif_config.h
@@ -20,8 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <ouroboros/utils.h>
-#include <ouroboros/common.h>
+#include <stdint.h>
+#include <unistd.h>
#ifndef OUROBOROS_DIF_CONFIG_H
#define OUROBOROS_DIF_CONFIG_H
diff --git a/include/ouroboros/flow.h b/include/ouroboros/flow.h
index 380c671b..aa377034 100644
--- a/include/ouroboros/flow.h
+++ b/include/ouroboros/flow.h
@@ -39,8 +39,8 @@
enum flow_state {
FLOW_NULL = 0,
- FLOW_ALLOCATED,
- FLOW_PENDING
+ FLOW_PENDING,
+ FLOW_ALLOCATED
};
#endif /* OUROBOROS_FLOW_H */
diff --git a/include/ouroboros/instance_name.h b/include/ouroboros/instance_name.h
index 351b222f..92681504 100644
--- a/include/ouroboros/instance_name.h
+++ b/include/ouroboros/instance_name.h
@@ -22,7 +22,9 @@
#ifndef INSTANCE_NAME_H
#define INSTANCE_NAME_H
-#include "common.h"
+#include <stdint.h>
+#include <unistd.h>
+#include <stdbool.h>
typedef struct {
char * name;
diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h
index 63e19e9d..08bee33e 100644
--- a/include/ouroboros/ipcp.h
+++ b/include/ouroboros/ipcp.h
@@ -20,16 +20,16 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef OUROBOROS_IPCP_H
-#define OUROBOROS_IPCP_H
-
-#include <ouroboros/common.h>
#include <ouroboros/dif_config.h>
#include <ouroboros/instance_name.h>
#include <ouroboros/sockets.h>
+#include <ouroboros/common.h>
#include <sys/types.h>
+#ifndef OUROBOROS_IPCP_H
+#define OUROBOROS_IPCP_H
+
struct ipcp;
/* Returns the process id */
@@ -59,13 +59,13 @@ int ipcp_name_reg(pid_t pid,
int ipcp_name_unreg(pid_t pid,
char * name);
-int ipcp_flow_alloc(pid_t pid,
- int port_id,
- pid_t n_pid,
- char * dst_name,
- char * src_ap_name,
- char * src_ae_name,
- struct qos_spec * qos);
+int ipcp_flow_alloc(pid_t pid,
+ int port_id,
+ pid_t n_pid,
+ char * dst_name,
+ char * src_ap_name,
+ char * src_ae_name,
+ enum qos_cube qos);
int ipcp_flow_alloc_resp(pid_t pid,
int port_id,
pid_t n_pid,
diff --git a/include/ouroboros/qos.h b/include/ouroboros/qos.h
new file mode 100644
index 00000000..c87b7c69
--- /dev/null
+++ b/include/ouroboros/qos.h
@@ -0,0 +1,35 @@
+/*
+ * Ouroboros - Copyright (C) 2016
+ *
+ * Quality of Service specification
+ *
+ * Sander Vrijders <sander.vrijders@intec.ugent.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef OUROBOROS_QOS_H
+#define OUROBOROS_QOS_H
+
+/* FIXME: may need revision */
+struct qos_spec {
+ char * qos_name;
+ char * dif_name;
+
+ uint32_t delay;
+ uint32_t jitter;
+};
+
+#endif
diff --git a/src/ipcpd/flow.c b/src/ipcpd/flow.c
index 10280f3d..4ca61341 100644
--- a/src/ipcpd/flow.c
+++ b/src/ipcpd/flow.c
@@ -26,10 +26,11 @@
#define OUROBOROS_PREFIX "ipcpd/flow"
#include <ouroboros/logs.h>
+#include <ouroboros/flow.h>
-flow_t * flow_create(int port_id)
+struct flow * flow_create(int port_id)
{
- flow_t * flow = malloc(sizeof *flow);
+ struct flow * flow = malloc(sizeof *flow);
if (flow == NULL) {
LOG_DBGF("Could not malloc flow.");
return NULL;
@@ -45,7 +46,7 @@ flow_t * flow_create(int port_id)
return flow;
}
-void flow_destroy(flow_t * flow)
+void flow_destroy(struct flow * flow)
{
if (flow == NULL)
return;
diff --git a/src/ipcpd/flow.h b/src/ipcpd/flow.h
index 43de5f94..6f50698e 100644
--- a/src/ipcpd/flow.h
+++ b/src/ipcpd/flow.h
@@ -20,32 +20,15 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef OUROBOROS_FLOW_H
-#define OUROBOROS_FLOW_H
+#ifndef OUROBOROS_IPCP_FLOW_H
+#define OUROBOROS_IPCP_FLOW_H
-#include <ouroboros/common.h>
#include <ouroboros/list.h>
+#include <ouroboros/flow.h>
#include <ouroboros/shm_ap_rbuff.h>
#include <pthread.h>
-/* same values as fcntl.h */
-#define FLOW_O_RDONLY 00000000
-#define FLOW_O_WRONLY 00000001
-#define FLOW_O_RDWR 00000002
-#define FLOW_O_ACCMODE 00000003
-
-#define FLOW_O_NONBLOCK 00004000
-#define FLOW_O_DEFAULT 00000002
-
-#define FLOW_O_INVALID (FLOW_O_WRONLY | FLOW_O_RDWR)
-
-enum flow_state {
- FLOW_NULL = 0,
- FLOW_ALLOCATED,
- FLOW_PENDING
-};
-
-typedef struct flow {
+struct flow {
struct list_head list;
int port_id;
@@ -53,9 +36,9 @@ typedef struct flow {
enum flow_state state;
pthread_mutex_t lock;
-} flow_t;
+};
-flow_t * flow_create(int port_id);
-void flow_destroy(flow_t * flow);
+struct flow * flow_create(int port_id);
+void flow_destroy(struct flow * flow);
#endif /* OUROBOROS_FLOW_H */
diff --git a/src/ipcpd/ipcp-ops.h b/src/ipcpd/ipcp-ops.h
index 5e90939d..a766c3ae 100644
--- a/src/ipcpd/ipcp-ops.h
+++ b/src/ipcpd/ipcp-ops.h
@@ -24,8 +24,8 @@
#ifndef IPCPD_IPCP_OPS_H
#define IPCPD_IPCP_OPS_H
-#include <ouroboros/common.h>
#include <ouroboros/dif_config.h>
+#include <ouroboros/common.h>
#include <sys/types.h>
struct ipcp_ops {
@@ -38,12 +38,12 @@ struct ipcp_ops {
size_t len);
int (* ipcp_name_reg)(char * name);
int (* ipcp_name_unreg)(char * name);
- int (* ipcp_flow_alloc)(int port_id,
- pid_t n_pid,
- char * dst_ap_name,
- char * src_ap_name,
- char * src_ae_name,
- struct qos_spec * qos);
+ int (* ipcp_flow_alloc)(int port_id,
+ pid_t n_pid,
+ char * dst_ap_name,
+ char * src_ap_name,
+ char * src_ae_name,
+ enum qos_cube qos);
int (* ipcp_flow_alloc_resp)(int port_id,
pid_t n_pid,
int response);
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c
index 060178bf..76d3620b 100644
--- a/src/ipcpd/ipcp.c
+++ b/src/ipcpd/ipcp.c
@@ -205,7 +205,7 @@ void * ipcp_main_loop(void * o)
msg->dst_name,
msg->src_ap_name,
msg->src_ae_name,
- NULL);
+ msg->qos_cube);
break;
case IPCP_MSG_CODE__IPCP_FLOW_ALLOC_RESP:
if (_ipcp->ops->ipcp_flow_alloc_resp == NULL) {
diff --git a/src/ipcpd/normal/CMakeLists.txt b/src/ipcpd/normal/CMakeLists.txt
index c13cbaa3..58584e20 100644
--- a/src/ipcpd/normal/CMakeLists.txt
+++ b/src/ipcpd/normal/CMakeLists.txt
@@ -1,5 +1,7 @@
-get_filename_component(CURRENT_SOURCE_PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
-get_filename_component(CURRENT_BINARY_PARENT_DIR ${CMAKE_CURRENT_BINARY_DIR} DIRECTORY)
+get_filename_component(CURRENT_SOURCE_PARENT_DIR
+ ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
+get_filename_component(CURRENT_BINARY_PARENT_DIR
+ ${CMAKE_CURRENT_BINARY_DIR} DIRECTORY)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c
index 4da27655..917c343b 100644
--- a/src/ipcpd/shim-udp/main.c
+++ b/src/ipcpd/shim-udp/main.c
@@ -32,6 +32,7 @@
#include <ouroboros/dif_config.h>
#include <ouroboros/sockets.h>
#include <ouroboros/bitmap.h>
+#include <ouroboros/flow.h>
#include <ouroboros/dev.h>
#include <ouroboros/rw_lock.h>
@@ -892,12 +893,12 @@ static int ipcp_udp_name_unreg(char * name)
return 0;
}
-static int ipcp_udp_flow_alloc(int port_id,
- pid_t n_pid,
- char * dst_name,
- char * src_ap_name,
- char * src_ae_name,
- struct qos_spec * qos)
+static int ipcp_udp_flow_alloc(int port_id,
+ pid_t n_pid,
+ char * dst_name,
+ char * src_ap_name,
+ char * src_ae_name,
+ enum qos_cube qos)
{
struct sockaddr_in l_saddr;
struct sockaddr_in r_saddr;
@@ -932,7 +933,7 @@ static int ipcp_udp_flow_alloc(int port_id,
return -1;
}
- if (qos != NULL)
+ if (qos != QOS_CUBE_BE)
LOG_DBGF("QoS requested. UDP/IP can't do that.");
fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
diff --git a/src/irmd/main.c b/src/irmd/main.c
index d266273d..65c173de 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -24,7 +24,6 @@
#include <ouroboros/config.h>
#include <ouroboros/logs.h>
-#include <ouroboros/common.h>
#include <ouroboros/sockets.h>
#include <ouroboros/irm.h>
#include <ouroboros/ipcp.h>
@@ -35,6 +34,8 @@
#include <ouroboros/dif_config.h>
#include <ouroboros/shm_du_map.h>
#include <ouroboros/bitmap.h>
+#include <ouroboros/flow.h>
+#include <ouroboros/qos.h>
#include <sys/socket.h>
#include <sys/un.h>
@@ -56,12 +57,6 @@
#define IRMD_THREADPOOL_SIZE 3
#endif
-enum flow_state {
- FLOW_NULL = 0,
- FLOW_PENDING,
- FLOW_ALLOCATED
-};
-
struct ipcp_entry {
struct list_head next;
instance_name_t * api;
@@ -927,6 +922,8 @@ static struct port_map_entry * flow_alloc(pid_t pid,
struct port_map_entry * pme;
instance_name_t * ipcp;
+ /* FIXME: Map qos_spec to qos_cube */
+
pthread_mutex_lock(&instance->s_lock);
if (instance->shutdown) {
pthread_mutex_unlock(&instance->s_lock);
@@ -965,7 +962,7 @@ static struct port_map_entry * flow_alloc(pid_t pid,
dst_name,
src_ap_name,
src_ae_name,
- qos) < 0) {
+ QOS_CUBE_BE) < 0) {
pthread_mutex_lock(&instance->r_lock);
list_del(&pme->next);
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 72e32512..ac9b93b1 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -39,9 +39,6 @@ set(SOURCE_FILES
utils.c
)
-install(FILES ${IRM_PROTO_HDRS} ${IPCP_PROTO_HDRS} ${DIF_CONFIG_PROTO_HDRS}
- DESTINATION include/ouroboros)
-
add_library(ouroboros SHARED ${SOURCE_FILES}
${IRM_PROTO_SRCS} ${IPCP_PROTO_SRCS} ${DIF_CONFIG_PROTO_SRCS})
diff --git a/src/lib/ipcp.c b/src/lib/ipcp.c
index 1f1e5c99..8a4f9629 100644
--- a/src/lib/ipcp.c
+++ b/src/lib/ipcp.c
@@ -361,13 +361,13 @@ int ipcp_name_unreg(pid_t pid,
return ret;
}
-int ipcp_flow_alloc(pid_t pid,
- int port_id,
- pid_t n_pid,
- char * dst_name,
- char * src_ap_name,
- char * src_ae_name,
- struct qos_spec * qos)
+int ipcp_flow_alloc(pid_t pid,
+ int port_id,
+ pid_t n_pid,
+ char * dst_name,
+ char * src_ap_name,
+ char * src_ae_name,
+ enum qos_cube qos)
{
ipcp_msg_t msg = IPCP_MSG__INIT;
ipcp_msg_t * recv_msg = NULL;
@@ -376,14 +376,16 @@ int ipcp_flow_alloc(pid_t pid,
if (dst_name == NULL || src_ap_name == NULL || src_ae_name == NULL)
return -EINVAL;
- msg.code = IPCP_MSG_CODE__IPCP_FLOW_ALLOC;
- msg.has_port_id = true;
- msg.port_id = port_id;
- msg.has_pid = true;
- msg.pid = n_pid;
- msg.src_ap_name = src_ap_name;
- msg.src_ae_name = src_ae_name;
- msg.dst_name = dst_name;
+ msg.code = IPCP_MSG_CODE__IPCP_FLOW_ALLOC;
+ msg.has_port_id = true;
+ msg.port_id = port_id;
+ msg.has_pid = true;
+ msg.pid = n_pid;
+ msg.src_ap_name = src_ap_name;
+ msg.src_ae_name = src_ae_name;
+ msg.dst_name = dst_name;
+ msg.has_qos_cube = true;
+ msg.qos_cube = qos;
recv_msg = send_recv_ipcp_msg(pid, &msg);
if (recv_msg == NULL)
diff --git a/src/lib/ipcpd_messages.proto b/src/lib/ipcpd_messages.proto
index 901adaa0..63e41986 100644
--- a/src/lib/ipcpd_messages.proto
+++ b/src/lib/ipcpd_messages.proto
@@ -24,9 +24,10 @@ message ipcp_msg {
optional string dst_name = 8;
optional string src_ap_name = 9;
optional string src_ae_name = 10;
- optional dif_config_msg conf = 11;
- optional sint32 fd = 12;
- optional sint32 pid = 13;
- optional sint32 response = 14;
- optional sint32 result = 15;
+ optional sint32 qos_cube = 11;
+ optional dif_config_msg conf = 12;
+ optional sint32 fd = 13;
+ optional sint32 pid = 14;
+ optional sint32 response = 15;
+ optional sint32 result = 16;
};