#ifndef _FWP_UTILS_H
#define _FWP_UTILS_H
-#include <time.h>
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
-#include <arpa/inet.h>
#include <fwp_msgb.h>
#define Kbit 1000
extern const char *ac_to_text[4];
*/
-#define DEBUG
-
-/* TODO: Introduce multilevel debugging massages and printf-like
- * debugging function. */
-
-#ifdef DEBUG
-#define FWP_DEBUG(fmt,args...) printf("fwp: %s: " fmt, __func__ , ##args)
-#define FWP_ERROR(fmt,args...) fprintf(stderr, "fwp: %s: " fmt, __func__ , ##args)
-
-#else
-#define FWP_DEBUG(fmt,args...)
-#define FWP_ERROR(fmt,args...)
-#endif
-
-static inline ssize_t
-_fwp_sendto(int s, const void *buf, size_t len, int flags,
- const fwp_sockaddr_t *sockaddr)
-{
- ssize_t ret;
- while ((ret = sendto(s, buf, len, flags, (struct sockaddr*)&sockaddr->addr, sockaddr->addrlen)) < 0) {
- if (errno != EINTR) break;
- }
- return ret;
-}
-
-static inline ssize_t
-_fwp_recvfrom(int s, void *buf, size_t len, int flags,
- fwp_sockaddr_t *sockaddr)
-{
- ssize_t ret;
- while ((ret = recvfrom(s, buf, len, flags, (struct sockaddr*)&sockaddr->addr,
- &sockaddr->addrlen)) < 0) {
- if (errno != EINTR) break;
- }
- return ret;
-}
-
-static inline ssize_t
-_fwp_send(int s, const void *buf, size_t len, int flags)
-{
- ssize_t ret;
- while ((ret = send(s, buf, len, flags)) < 0) {
- if (errno != EINTR) break;
- }
- return ret;
-}
-
-static inline ssize_t
-_fwp_recv(int s, void *buf, size_t len, int flags)
-{
- ssize_t ret;
- while ((ret = recv(s, buf, len, flags)) < 0) {
- if (errno != EINTR) break;
- }
- return ret;
-}
-
-inline void fwp_timespec_add (struct timespec *sum, const struct timespec *left,
+void fwp_timespec_add (struct timespec *sum, const struct timespec *left,
const struct timespec *right);
-inline void fwp_timespec_sub (struct timespec *diff, const struct timespec *left,
+void fwp_timespec_sub (struct timespec *diff, const struct timespec *left,
const struct timespec *right);
void fwp_timespec_modulo(struct timespec *dividend, struct timespec *dividor,
struct timespec *remainder);