1 #ifndef AUCAT_H 2 #define AUCAT_H 3 4 #include "amsg.h" 5 6 struct aucat { 7 int fd; /* socket */ 8 struct amsg rmsg, wmsg; /* temporary messages */ 9 size_t wtodo, rtodo; /* bytes to complete the packet */ 10 #define RSTATE_MSG 0 /* message being received */ 11 #define RSTATE_DATA 1 /* data being received */ 12 unsigned rstate; /* one of above */ 13 #define WSTATE_IDLE 2 /* nothing to do */ 14 #define WSTATE_MSG 3 /* message being transferred */ 15 #define WSTATE_DATA 4 /* data being transferred */ 16 unsigned wstate; /* one of above */ 17 }; 18 19 int aucat_rmsg(struct aucat *, int *); 20 int aucat_wmsg(struct aucat *, int *); 21 size_t aucat_rdata(struct aucat *, void *, size_t, int *); 22 size_t aucat_wdata(struct aucat *, const void *, size_t, unsigned, int *); 23 int aucat_open(struct aucat *, const char *, unsigned, int); 24 void aucat_close(struct aucat *, int); 25 int aucat_pollfd(struct aucat *, struct pollfd *, int); 26 int aucat_revents(struct aucat *, struct pollfd *); 27 int aucat_setfl(struct aucat *, int, int *); 28 29 #endif /* !defined(AUCAT_H) */ 30