summaryrefslogtreecommitdiff
path: root/src/ipcpd
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 /src/ipcpd
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
Diffstat (limited to 'src/ipcpd')
-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
6 files changed, 31 insertions, 44 deletions
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);