diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-12-23 18:13:40 +0100 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-12-24 12:19:10 +0100 |
commit | f97dee45d3c1b0088aa8010a1c9d59593c3d0df0 (patch) | |
tree | f7d3be68e5cbbab230cd114e9dcf3e167f7454e5 /include | |
parent | cbaa4a95cc6c74c7a2cfe8a5acaf7b4867fc343a (diff) | |
download | ouroboros-f97dee45d3c1b0088aa8010a1c9d59593c3d0df0.tar.gz ouroboros-f97dee45d3c1b0088aa8010a1c9d59593c3d0df0.zip |
ipcpd, lib: Refactor normal ipcp and cdap
Refactors the normal IPCP fmgr and ribmgr, and modifies the API for
cdap so that no callbacks are needed.
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/cdap.h | 46 | ||||
-rw-r--r-- | include/ouroboros/config.h.in | 1 | ||||
-rw-r--r-- | include/ouroboros/ipcp-dev.h | 4 | ||||
-rw-r--r-- | include/ouroboros/shared.h | 6 |
4 files changed, 28 insertions, 29 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/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 */ |