diff options
author | dimitri staessens <[email protected]> | 2016-11-01 17:31:16 +0000 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2016-11-01 17:31:16 +0000 |
commit | e90d3b902096a90fc9057c6c9929fac39618c967 (patch) | |
tree | 10c4029e0778dd80d6f1ed822e9dcd2f450feb8a /include | |
parent | 0a9f1f2936381dfe350c1846b3bafc306590a88f (diff) | |
parent | c69f318e8cbdb8124e40e6a47b1bbffe35914a44 (diff) | |
download | ouroboros-e90d3b902096a90fc9057c6c9929fac39618c967.tar.gz ouroboros-e90d3b902096a90fc9057c6c9929fac39618c967.zip |
Merged in sandervrijders/ouroboros/be-cdap-revised (pull request #297)
lib: Simplify CDAP API
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/cdap.h | 72 |
1 files changed, 23 insertions, 49 deletions
diff --git a/include/ouroboros/cdap.h b/include/ouroboros/cdap.h index bd8aa551..7312fb6f 100644 --- a/include/ouroboros/cdap.h +++ b/include/ouroboros/cdap.h @@ -30,43 +30,32 @@ #define F_SYNC 0x0001 +enum cdap_opcode { + CDAP_READ = 0, + CDAP_WRITE, + CDAP_START, + CDAP_STOP, + CDAP_CREATE, + CDAP_DELETE +}; + 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); - - int (* cdap_read)(struct cdap * instance, - int invoke_id, - char * name); - int (* cdap_write)(struct cdap * instance, - int invoke_id, - char * name, - uint8_t * data, - size_t len, - uint32_t flags); - - int (* cdap_create)(struct cdap * instance, - int invoke_id, - char * name, - uint8_t * data, - size_t len); - int (* cdap_delete)(struct cdap * instance, - int invoke_id, - char * name, - uint8_t * data, - size_t len); - - int (* cdap_start)(struct cdap * instance, - int invoke_id, - char * name); - int (* cdap_stop)(struct cdap * instance, - int invoke_id, - char * name); }; /* Assumes flow is blocking */ @@ -75,27 +64,12 @@ struct cdap * cdap_create(struct cdap_ops * ops, int cdap_destroy(struct cdap * instance); /* Returns a positive invoke-id on success to be used in the callback */ -int cdap_send_read(struct cdap * instance, - char * name); -int cdap_send_write(struct cdap * instance, - char * name, - uint8_t * data, - size_t len, - uint32_t flags); - -int cdap_send_create(struct cdap * instance, - char * name, - uint8_t * data, - size_t len); -int cdap_send_delete(struct cdap * instance, - char * name, - uint8_t * data, - size_t len); - -int cdap_send_start(struct cdap * instance, - char * name); -int cdap_send_stop(struct cdap * instance, - char * name); +int cdap_send_request(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, |