/* * Secure eXtended Message Passing framework * Secure eXtended Transport layer implementation (libsxt). * * socket wrapper * * (c) Alexander Vdolainen 2016 * * libsxmp is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * libsxmp is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see ."; * */ #ifndef __SXT_SOCKET_H__ #define __SXT_SOCKET_H__ enum { SXTSOCKET_NIL = 0, SXTSOCKET_ACTIVE, SXTSOCKET_DEAD, SXTSOCKET_CLOSED, }; #define SXTSCK_RDR (1 << 1) #define SXTSCK_WRR (1 << 2) #define SXTSCT_TMO (1 << 3) #define SXTSCT_ERR (1 << 4) typedef struct __sxtsocket_type { uint8_t state; int fd; } sxtsocket_t; /* API */ sxtsocket_t *sxtsocket_new(void); int sxtsocket_close(sxtsocket_t *); int sxtsocket_setnb(sxtsocket_t *); ssize_t sxtsocket_read(sxtsocket_t *, void *, size_t); ssize_t sxtsocket_write(sxtsocket_t *, void *, size_t); int sxtsocket_poll(sxtsocket_t **, int, sxtsocket_t **, int, int, int **, int **); void sxtsocket_free(sxtsocket_t *); #endif /* __SXT_SOCKET_H__ */