#ifndef __MQ_NTF_H #define __MQ_NTF_H #include #include #include #include #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