/* * librelay.h * * IPQ library for userspace. * * ----------, James Morris, original libipq cod * 2003-10-29, Don Mahurin, adopted for use with iptables RELAY module * * Copyright (c) 2000-2001 Netfilter Core Team * * 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. * */ #ifndef _LIBRELAY_NL_H #define _LIBRELAY_NL_H #include #include #include #include #include #include #include #include #include #ifdef DEBUG_LIBIPQ #include #define LDEBUG(x...) fprintf(stderr, ## x) #else #define LDEBUG(x...) #endif /* DEBUG_LIBIPQ */ /* FIXME: glibc sucks */ #ifndef MSG_TRUNC #define MSG_TRUNC 0x20 #endif struct relay_handle { int fd; u_int8_t blocking; struct sockaddr_nl local; struct sockaddr_nl peer; }; struct relay_handle *relay_create_handle(u_int32_t flags, u_int32_t protocol); int relay_destroy_handle(struct relay_handle *h); ssize_t relay_read(const struct relay_handle *h, unsigned char *buf, size_t len, int timeout); int relay_set_mode(const struct relay_handle *h, u_int8_t mode, size_t len); int relay_message_type(const unsigned char *buf); int relay_get_msgerr(const unsigned char *buf); int relay_ctl(const struct relay_handle *h, int request, ...); char *relay_errstr(void); void relay_perror(const char *s); #endif /* _LIBRELAY_NL_H */