mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 13:17:56 +00:00
27a0a6eeb5
Replaces (const char *file, unsigned int line, const char *function) arguments to all logging functions, simplifies malloc/free tracking code in overlay_buffer.c and Rhizome manifest alloc/free tracking in rhizome_bundle.c. Use __HERE__ macro instead of (__FILE__, __LINE__, __FUNCTION__) everywhere. Special __NOWHERE__ macro is equivalent to (NULL, 0, NULL). Declare net.c functions in new "net.h" header, so log.c doesn't have to pull in the entire "serval.h" just to use write_str(). Facilitates progress on issue #2.
44 lines
2.1 KiB
C
44 lines
2.1 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 "log.h" // for __HERE__ and struct __sourceloc
|
|
|
|
#define set_nonblock(fd) (_set_nonblock(fd, __HERE__))
|
|
#define set_block(fd) (_set_block(fd, __HERE__))
|
|
#define read_nonblock(fd,buf,len) (_read_nonblock(fd, buf, len, __HERE__))
|
|
#define write_all(fd,buf,len) (_write_all(fd, buf, len, __HERE__))
|
|
#define write_nonblock(fd,buf,len) (_write_nonblock(fd, buf, len, __HERE__))
|
|
#define write_all_nonblock(fd,buf,len) (_write_all_nonblock(fd, buf, len, __HERE__))
|
|
#define write_str(fd,str) (_write_str(fd, str, __HERE__))
|
|
#define write_str_nonblock(fd,str) (_write_str_nonblock(fd, str, __HERE__))
|
|
|
|
int _set_nonblock(int fd, struct __sourceloc where);
|
|
int _set_block(int fd, struct __sourceloc where);
|
|
ssize_t _read_nonblock(int fd, void *buf, size_t len, struct __sourceloc where);
|
|
ssize_t _write_all(int fd, const void *buf, size_t len, struct __sourceloc where);
|
|
ssize_t _write_nonblock(int fd, const void *buf, size_t len, struct __sourceloc where);
|
|
ssize_t _write_all_nonblock(int fd, const void *buf, size_t len, struct __sourceloc where);
|
|
ssize_t _write_str(int fd, const char *str, struct __sourceloc where);
|
|
ssize_t _write_str_nonblock(int fd, const char *str, struct __sourceloc where);
|
|
|
|
#endif // __SERVALD_NET_H
|