sxt: socket wrapper header with API added;

master
Alexander Vdolainen 8 years ago
parent 967f161887
commit 5135deef30

@ -0,0 +1,57 @@
/*
* Secure eXtended Message Passing framework
* Secure eXtended Transport layer implementation (libsxt).
*
* socket wrapper
*
* (c) Alexander Vdolainen 2016 <avdolainen@zoho.com>
*
* 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 <http://www.gnu.org/licenses/>.";
*
*/
#ifndef __SXT_SOCKET_H__
#define __SXT_SOCKET_H__
enum {
SXTSOCKET_NIL = 0,
SXTSOCKET_ACTIVE,
SXTSOCKET_DEAD,
};
#define SXTSCK_RDR (1 << 1)
#define SXTSCK_WRR (1 << 2)
#define SXTSCT_TMO (1 << 3)
typedef struct __sxtsocket_type {
uint8_t state;
int fd;
} sxtsocket_t;
/* API */
sxtsocket_t *sxtsocket_new();
int sxtsocket_close(sxtsocket_t *);
int sxtsocket_setnb(sxtsocket_t *);
size_t sxtsocket_read(sxtsocket_t *, void *, size_t);
size_t sxtsocket_write(sxtsocket_t *, void *, size_t);
int sxtsocket_poll(sxtsocket_t **, int, sxtsocket_t **, int, void *);
void sxtsocket_free(sxtsocket_t *);
#endif /* __SXT_SOCKET_H__ */
Loading…
Cancel
Save