mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-27 00:31:09 +00:00
d3c2205d44
The new header "os.h" defines a supplemental API around existing basic operating system services (system calls and standard library functions). Moved some function prototypes from serval.h and net.h into os.h. This allows non-servald executables to take advantage of this API without having to include serval.h and bringing in all the other servald link-time baggage.
46 lines
2.3 KiB
C
46 lines
2.3 KiB
C
/*
|
|
Copyright (C) 2012 Serval Project Inc.
|
|
|
|
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.
|
|
|
|
This program 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 General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
#ifndef __SERVALD_NET_H
|
|
#define __SERVALD_NET_H
|
|
|
|
#include <sys/types.h> // for size_t, ssize_t
|
|
#include <sys/socket.h> // for struct sockaddr, socklen_t
|
|
#include "log.h" // for __WHENCE__ and struct __sourceloc
|
|
|
|
#define set_nonblock(fd) (_set_nonblock(fd, __WHENCE__))
|
|
#define set_block(fd) (_set_block(fd, __WHENCE__))
|
|
#define read_nonblock(fd,buf,len) (_read_nonblock(fd, buf, len, __WHENCE__))
|
|
#define write_all(fd,buf,len) (_write_all(fd, buf, len, __WHENCE__))
|
|
#define write_nonblock(fd,buf,len) (_write_nonblock(fd, buf, len, __WHENCE__))
|
|
#define write_all_nonblock(fd,buf,len) (_write_all_nonblock(fd, buf, len, __WHENCE__))
|
|
#define write_str(fd,str) (_write_str(fd, str, __WHENCE__))
|
|
#define write_str_nonblock(fd,str) (_write_str_nonblock(fd, str, __WHENCE__))
|
|
|
|
int _set_nonblock(int fd, struct __sourceloc __whence);
|
|
int _set_block(int fd, struct __sourceloc __whence);
|
|
ssize_t _read_nonblock(int fd, void *buf, size_t len, struct __sourceloc __whence);
|
|
ssize_t _write_all(int fd, const void *buf, size_t len, struct __sourceloc __whence);
|
|
ssize_t _write_nonblock(int fd, const void *buf, size_t len, struct __sourceloc __whence);
|
|
ssize_t _write_all_nonblock(int fd, const void *buf, size_t len, struct __sourceloc __whence);
|
|
ssize_t _write_str(int fd, const char *str, struct __sourceloc __whence);
|
|
ssize_t _write_str_nonblock(int fd, const char *str, struct __sourceloc __whence);
|
|
ssize_t recvwithttl(int sock, unsigned char *buffer, size_t bufferlen, int *ttl, struct sockaddr *recvaddr, socklen_t *recvaddrlen);
|
|
|
|
#endif // __SERVALD_NET_H
|