diff options
author | FreeArtMan <dos21h@gmail.com> | 2017-03-05 22:45:47 +0000 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2017-03-05 22:45:47 +0000 |
commit | fc16bb9a991b7ba1e60aa3f9282323deaf80c077 (patch) | |
tree | d03a165af45d938695c38dbc55c3257d23c34ee9 /mq_ntf.h | |
parent | b04690e9015d3263b2ee2bb42dd7a9891fc4d89b (diff) | |
download | agni-fc16bb9a991b7ba1e60aa3f9282323deaf80c077.tar.gz agni-fc16bb9a991b7ba1e60aa3f9282323deaf80c077.zip |
Pushed full versions of mq_ntf
Diffstat (limited to 'mq_ntf.h')
-rw-r--r--[l---------] | mq_ntf.h | 53 |
1 files changed, 52 insertions, 1 deletions
@@ -1 +1,52 @@ -lib/mq_ntf/mq_ntf.h
\ No newline at end of file +#ifndef __MQ_NTF_H +#define __MQ_NTF_H + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <mqueue.h> + +#include "mq_cmd.h" +#include "debug.h" + + +//async io multiplexer +typedef struct mq_ntf_io_mplx +{ + struct timeval tv; + fd_set io_fds; +} mq_ntf_io_mplx; + +#define MQ_OUT 1 +#define MQ_IN 2 + +/* +supposed format agni-[id]-[in/out] +in is for input of thread (send to in and thread will recieve), +out if for output of thread (read from out to recieve from thread) +*/ +#define MQ_PREFIX "/agni-" +typedef struct mq_ntf_mdt +{ + int id; + mqd_t mq_in; + mqd_t mq_out; + //mq_ntf_io_mplx io_mplx; + //_Atomic int used; nado? +} mq_ntf_mdt; + +mq_ntf_mdt *mq_ntf_create(int id); +int mq_ntf_open(mq_ntf_mdt *mq, int id); +int mq_ntf_select(mq_ntf_mdt *mq, int dir); +int mq_ntf_read(mq_ntf_mdt *mq, int dir, char *buf, size_t size); +int mq_ntf_write(mq_ntf_mdt *mq, int dir, const char *buf, size_t size); +int mq_ntf_count(mq_ntf_mdt *mq, int dir); +int mq_ntf_close(mq_ntf_mdt *mq); +int mq_ntf_cmd_send(mq_ntf_mdt *mq, mq_cmd *cmd); +int mq_ntf_cmd_recv(mq_ntf_mdt *mq, mq_cmd *cmd); +int mq_drain_q(mqd_t mqd); +int mq_ntf_drain(mq_ntf_mdt *mq); +int mq_ntf_getattr(mq_ntf_mdt *mq, int dir, struct mq_attr **attr); +void mq_ntf_free(mq_ntf_mdt *mq); + +#endif
\ No newline at end of file |