1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2025-04-21 12:27:27 +03:00

tools/: added network (TCP) I/O helper functions

- include/netio.h, lib/netio.c: network I/O helper functions
- lib/Makefile (OBJS): added netio.o
This commit is contained in:
Werner Almesberger
2011-04-10 15:25:43 -03:00
parent a2f38c044e
commit 3b0ee3c00a
3 changed files with 221 additions and 1 deletions

34
tools/include/netio.h Normal file
View File

@@ -0,0 +1,34 @@
/*
* include/netio.h - Helper functions for socket I/O
*
* Written 2011 by Werner Almesberger
* Copyright 2011 Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef NETIO_H
#define NETIO_H
#include <stdint.h>
#include <sys/types.h>
struct netio;
extern int netio_verbose;
int netio_getc(struct netio *dsc, uint8_t *res);
ssize_t netio_read_until(struct netio *dsc, const char *end, void *buf,
size_t len, char *last);
ssize_t netio_read(struct netio *dsc, void *buf, size_t len);
int netio_write(struct netio *dsc, const void *data, size_t len);
int netio_printf(struct netio *dsc, const char *fmt, ...);
struct netio *netio_open(int s);
void netio_close(struct netio *dsc);
#endif /* !NETIO_H */