summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-12-24 12:54:16 +0100
committerSander Vrijders <[email protected]>2016-12-24 12:54:16 +0100
commit7348a7d587adc3cb1bc11ef7513ef7b03bc40349 (patch)
tree54c4406c135621d44fd9468c12a6b26e3e5d4f74 /include
parent55eaed508c9f68b350f29cf2c4e96be4e57b0b37 (diff)
parent8910bd28e2b6269f0900c8215352ab5d177a3b54 (diff)
downloadouroboros-7348a7d587adc3cb1bc11ef7513ef7b03bc40349.tar.gz
ouroboros-7348a7d587adc3cb1bc11ef7513ef7b03bc40349.zip
Merged in dstaesse/ouroboros/be-normal (pull request #325)
Be normal
Diffstat (limited to 'include')
-rw-r--r--include/ouroboros/cdap.h46
-rw-r--r--include/ouroboros/config.h.in1
-rw-r--r--include/ouroboros/ipcp-dev.h4
-rw-r--r--include/ouroboros/logs.h7
-rw-r--r--include/ouroboros/shared.h6
5 files changed, 33 insertions, 31 deletions
diff --git a/include/ouroboros/cdap.h b/include/ouroboros/cdap.h
index 7312fb6f..89d598f9 100644
--- a/include/ouroboros/cdap.h
+++ b/include/ouroboros/cdap.h
@@ -30,6 +30,8 @@
#define F_SYNC 0x0001
+#define INVALID_CDAP_KEY -1
+
enum cdap_opcode {
CDAP_READ = 0,
CDAP_WRITE,
@@ -41,40 +43,36 @@ enum cdap_opcode {
struct cdap;
-/* Callback functions that work on the application's RIB */
-struct cdap_ops {
- int (* cdap_request)(struct cdap * instance,
- int invoke_id,
- enum cdap_opcode opcode,
- char * name,
- uint8_t * data,
- size_t len,
- uint32_t flags);
-
- int (* cdap_reply)(struct cdap * instance,
- int invoke_id,
- int result,
- uint8_t * data,
- size_t len);
-};
+typedef int32_t cdap_key_t;
/* Assumes flow is blocking */
-struct cdap * cdap_create(struct cdap_ops * ops,
- int fd);
+struct cdap * cdap_create(int fd);
+
int cdap_destroy(struct cdap * instance);
-/* Returns a positive invoke-id on success to be used in the callback */
-int cdap_send_request(struct cdap * instance,
+cdap_key_t cdap_request_send(struct cdap * instance,
enum cdap_opcode code,
char * name,
uint8_t * data,
size_t len,
uint32_t flags);
-/* Can only be called following a callback function */
-int cdap_send_reply(struct cdap * instance,
- int invoke_id,
+int cdap_reply_wait(struct cdap * instance,
+ cdap_key_t key,
+ uint8_t ** data,
+ size_t * len);
+
+cdap_key_t cdap_request_wait(struct cdap * instance,
+ enum cdap_opcode * opcode,
+ char ** name,
+ uint8_t ** data,
+ size_t * len,
+ uint32_t * flags);
+
+int cdap_reply_send(struct cdap * instance,
+ cdap_key_t key,
int result,
uint8_t * data,
size_t len);
-#endif
+
+#endif /* OUROBOROS_CDAP_H */
diff --git a/include/ouroboros/config.h.in b/include/ouroboros/config.h.in
index 2417a5c0..4208c6d2 100644
--- a/include/ouroboros/config.h.in
+++ b/include/ouroboros/config.h.in
@@ -49,6 +49,7 @@
#define IRMD_MAX_FLOWS 4096
#define IRMD_THREADPOOL_SIZE 5
#define IPCPD_THREADPOOL_SIZE 3
+#define IPCPD_MAX_CONNS IRMD_MAX_FLOWS
#define LOG_DIR "/@LOG_DIR@/"
#define PTHREAD_COND_CLOCK CLOCK_MONOTONIC
#define PFT_SIZE 1 << 12
diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h
index 19a66762..fd1e7478 100644
--- a/include/ouroboros/ipcp-dev.h
+++ b/include/ouroboros/ipcp-dev.h
@@ -45,7 +45,7 @@ void ipcp_flow_fini(int fd);
void ipcp_flow_del(struct shm_du_buff * sdb);
-int ipcp_flow_get_qoscube(int fd,
- enum qos_cube * cube);
+int ipcp_flow_get_qoscube(int fd,
+ qoscube_t * cube);
#endif /* OUROBOROS_IPCP_DEV_H */
diff --git a/include/ouroboros/logs.h b/include/ouroboros/logs.h
index 56eac068..6a16aca6 100644
--- a/include/ouroboros/logs.h
+++ b/include/ouroboros/logs.h
@@ -24,6 +24,7 @@
#ifndef OUROBOROS_LOGS_H
#define OUROBOROS_LOGS_H
+#include <unistd.h>
#include <stdio.h>
#ifndef OUROBOROS_PREFIX
@@ -55,8 +56,10 @@ extern FILE * logfile;
FMT ANSI_COLOR_RESET "\n", ##ARGS); \
fflush(logfile); \
} else { \
- printf(CLR OUROBOROS_PREFIX "(" LVL "): " \
- FMT ANSI_COLOR_RESET "\n", ##ARGS); \
+ printf(CLR "==%05d== " \
+ OUROBOROS_PREFIX "(" LVL "): " \
+ FMT ANSI_COLOR_RESET "\n", getpid(), \
+ ##ARGS); \
} \
} while (0)
diff --git a/include/ouroboros/shared.h b/include/ouroboros/shared.h
index c38b1bde..7b281cc2 100644
--- a/include/ouroboros/shared.h
+++ b/include/ouroboros/shared.h
@@ -24,10 +24,10 @@
#define OUROBOROS_SHARED_H
/* FIXME: To be decided which QoS cubes we support */
-enum qos_cube {
+typedef enum qos_cube {
QOS_CUBE_BE = 0,
QOS_CUBE_VIDEO,
- QOS_MAX
-};
+ QOS_CUBE_MAX
+} qoscube_t;
#endif /* OUROBOROS_SHARED_H */