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 unsigned maxwrite; /* bytes we're allowed to write */ 18 }; 19 20 int _aucat_rmsg(struct aucat *, int *); 21 int _aucat_wmsg(struct aucat *, int *); 22 size_t _aucat_rdata(struct aucat *, void *, size_t, int *); 23 size_t _aucat_wdata(struct aucat *, const void *, size_t, unsigned, int *); 24 int _aucat_open(struct aucat *, const char *, unsigned); 25 void _aucat_close(struct aucat *, int); 26 int _aucat_pollfd(struct aucat *, struct pollfd *, int); 27 int _aucat_revents(struct aucat *, struct pollfd *); 28 int _aucat_setfl(struct aucat *, int, int *); 29 30 #endif /* !defined(AUCAT_H) */ 31