N-sim
Emulation and simulation of
Wireless Sensor Networks



   Home


   Project Page


   Download


   CVS



   Installation


   Configuration


   Plug-ins




 Hosted by
SourceForge.net Logo

/home/brennan/n-sim/Vaike/linux/system-addons/networking/libipq.h

Go to the documentation of this file.
00001 /*
00002  * libipq.h
00003  *
00004  * IPQ library for userspace.
00005  *
00006  * Author: James Morris <jmorris@intercode.com.au>
00007  *
00008  * Copyright (c) 2000-2001 Netfilter Core Team
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  */
00021 #ifndef _LIBIPQ_H
00022 #define _LIBIPQ_H
00023 
00024 #include <errno.h>
00025 #include <unistd.h>
00026 #include <fcntl.h>
00027 #include <sys/types.h>
00028 #include <sys/socket.h>
00029 #include <sys/uio.h>
00030 #include <asm/types.h>
00031 #include <linux/netlink.h>
00032 
00033 #include <linux/netfilter_ipv4/ip_queue.h>
00034 typedef unsigned long ipq_id_t;
00035 
00036 #ifdef DEBUG_LIBIPQ
00037 #include <stdio.h>
00038 #define LDEBUG(x...) fprintf(stderr, ## x)
00039 #else
00040 #define LDEBUG(x...)
00041 #endif  /* DEBUG_LIBIPQ */
00042 
00043 /* FIXME: glibc sucks */
00044 #ifndef MSG_TRUNC
00045 #define MSG_TRUNC 0x20
00046 #endif
00047 
00048 struct ipq_handle
00049 {
00050         int fd;
00051         u_int8_t blocking;
00052         struct sockaddr_nl local;
00053         struct sockaddr_nl peer;
00054 };
00055 
00056 struct ipq_handle *ipq_create_handle(u_int32_t flags, u_int32_t protocol);
00057 
00058 int ipq_destroy_handle(struct ipq_handle *h);
00059 
00060 ssize_t ipq_read(const struct ipq_handle *h,
00061                 unsigned char *buf, size_t len, int timeout);
00062 
00063 int ipq_set_mode(const struct ipq_handle *h, u_int8_t mode, size_t len);
00064 
00065 ipq_packet_msg_t *ipq_get_packet(const unsigned char *buf);
00066 
00067 int ipq_message_type(const unsigned char *buf);
00068 
00069 int ipq_get_msgerr(const unsigned char *buf);
00070 
00071 int ipq_set_verdict(const struct ipq_handle *h,
00072                     ipq_id_t id,
00073                     unsigned int verdict,
00074                     size_t data_len,
00075                     unsigned char *buf);
00076 
00077 int ipq_ctl(const struct ipq_handle *h, int request, ...);
00078 
00079 char *ipq_errstr(void);
00080 void ipq_perror(const char *s);
00081 
00082 #endif  /* _LIBIPQ_H */
00083 


© 2007, Los Alamos National Security, LLC.