├── LICENSE ├── daq-2.2.1 ├── COPYING ├── ChangeLog ├── Makefile.am ├── Makefile.in ├── README ├── aclocal.m4 ├── api │ ├── Makefile.am │ ├── Makefile.in │ ├── daq.h │ ├── daq_api.h │ ├── daq_base.c │ ├── daq_common.h │ ├── daq_mod_ops.c │ ├── daq_version.h │ └── daq_version.h.in ├── compile ├── config.guess ├── config.h.in ├── config.sub ├── configure ├── configure.ac ├── daq.dsp ├── depcomp ├── install-sh ├── ltmain.sh ├── m4 │ ├── ax_check_compile_flag.m4 │ ├── libtool.m4 │ ├── ltoptions.m4 │ ├── ltsugar.m4 │ ├── ltversion.m4 │ ├── lt~obsolete.m4 │ └── sf.m4 ├── missing ├── os-daq-modules │ ├── Makefile.am │ ├── Makefile.in │ ├── daq-modules-config.in │ ├── daq_afpacket.c │ ├── daq_dpdk.c │ ├── daq_dump.c │ ├── daq_ipfw.c │ ├── daq_ipq.c │ ├── daq_netmap.c │ ├── daq_nfq.c │ ├── daq_pcap.c │ ├── daq_static_modules.c │ └── daq_static_modules.h └── sfbpf │ ├── IP6_misc.h │ ├── Makefile.am │ ├── Makefile.in │ ├── arcnet.h │ ├── atmuni31.h │ ├── bittypes.h │ ├── ethertype.h │ ├── gencode.h │ ├── grammar.y │ ├── ieee80211.h │ ├── ipnet.h │ ├── llc.h │ ├── namedb.h │ ├── nlpid.h │ ├── ppp.h │ ├── runlex.sh │ ├── scanner.l │ ├── sf-redefines.h │ ├── sf_bpf_filter.c │ ├── sf_bpf_printer.c │ ├── sf_gencode.c │ ├── sf_nametoaddr.c │ ├── sf_optimize.c │ ├── sfbpf-int.c │ ├── sfbpf-int.h │ ├── sfbpf.h │ ├── sfbpf_dlt.h │ ├── sll.h │ ├── sunatmpos.h │ └── win32-stdinc.h └── readme.md /daq-2.2.1/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | 3 | if BUILD_MODULES 4 | MODULES_DIR = os-daq-modules 5 | endif 6 | SUBDIRS = api sfbpf $(MODULES_DIR) 7 | 8 | ACLOCAL_AMFLAGS = -I m4 9 | 10 | EXTRA_DIST = \ 11 | daq.dsp 12 | -------------------------------------------------------------------------------- /daq-2.2.1/api/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | 3 | ACLOCAL_AMFLAGS = -I m4 4 | 5 | include_HEADERS = daq.h daq_api.h daq_common.h 6 | 7 | lib_LTLIBRARIES = libdaq.la libdaq_static.la 8 | 9 | libdaq_la_SOURCES = daq_base.c daq_mod_ops.c daq.h daq_api.h daq_common.h daq_version.h 10 | libdaq_la_LDFLAGS = -version-info 4:1:0 @XCCFLAGS@ 11 | libdaq_la_LIBADD = @LIBDL@ 12 | 13 | libdaq_static_la_SOURCES = daq_base.c daq_mod_ops.c daq.h daq_api.h daq_common.h daq_version.h 14 | libdaq_static_la_CFLAGS = $(AM_CFLAGS) -DSTATIC_MODULE_LIST 15 | libdaq_static_la_LDFLAGS = -static 16 | -------------------------------------------------------------------------------- /daq-2.2.1/api/daq.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved. 3 | ** Copyright (C) 2010-2013 Sourcefire, Inc. 4 | ** Author: Michael R. Altizer 5 | ** 6 | ** This program is free software; you can redistribute it and/or modify 7 | ** it under the terms of the GNU General Public License Version 2 as 8 | ** published by the Free Software Foundation. You may not use, modify or 9 | ** distribute this program under any other version of the GNU General 10 | ** Public License. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software 19 | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef _DAQ_H 23 | #define _DAQ_H 24 | 25 | #include 26 | #include 27 | 28 | #define DAQ_VERSION 6 29 | 30 | /* Definition of the structures returned by daq_get_module_list(). */ 31 | typedef struct { 32 | char *name; /* Module name */ 33 | uint32_t version; /* Module version */ 34 | uint32_t type; /* Module capabilities */ 35 | } DAQ_Module_Info_t; 36 | 37 | /* Library version information functions. */ 38 | DAQ_LINKAGE uint32_t daq_version_number(void); 39 | DAQ_LINKAGE const char *daq_version_string(void); 40 | 41 | /* Functions for loading, handling, and unloading DAQ modules. */ 42 | DAQ_LINKAGE void daq_set_verbosity(int level); 43 | DAQ_LINKAGE int daq_load_modules(const char *module_dirs[]); 44 | DAQ_LINKAGE const DAQ_Module_t *daq_find_module(const char *name); 45 | DAQ_LINKAGE int daq_get_module_list(DAQ_Module_Info_t *list[]); 46 | DAQ_LINKAGE void daq_free_module_list(DAQ_Module_Info_t *list, int size); 47 | DAQ_LINKAGE void daq_unload_modules(void); 48 | DAQ_LINKAGE void daq_print_stats(DAQ_Stats_t *stats, FILE *fp); 49 | 50 | /* Enumeration to String translation functions. */ 51 | DAQ_LINKAGE const char *daq_mode_string(DAQ_Mode mode); 52 | DAQ_LINKAGE const char *daq_state_string(DAQ_State state); 53 | DAQ_LINKAGE const char *daq_verdict_string(DAQ_Verdict verdict); 54 | 55 | /* DAQ Configuration Dictionary Functions */ 56 | DAQ_LINKAGE const char *daq_config_get_value(DAQ_Config_t *config, const char *key); 57 | DAQ_LINKAGE void daq_config_set_value(DAQ_Config_t *config, const char *key, const char *value); 58 | DAQ_LINKAGE void daq_config_clear_value(DAQ_Config_t *config, const char *key); 59 | DAQ_LINKAGE void daq_config_clear_values(DAQ_Config_t *config); 60 | 61 | /* DAQ Module functions. */ 62 | DAQ_LINKAGE const char *daq_get_name(const DAQ_Module_t *module); 63 | DAQ_LINKAGE uint32_t daq_get_type(const DAQ_Module_t *module); 64 | 65 | /* DAQ Module Instance functions */ 66 | DAQ_LINKAGE int daq_initialize(const DAQ_Module_t *module, const DAQ_Config_t *config, void **handle, char *errbuf, size_t len); 67 | DAQ_LINKAGE int daq_set_filter(const DAQ_Module_t *module, void *handle, const char *filter); 68 | DAQ_LINKAGE int daq_start(const DAQ_Module_t *module, void *handle); 69 | DAQ_LINKAGE int daq_acquire(const DAQ_Module_t *module, void *handle, int cnt, DAQ_Analysis_Func_t callback, void *user); 70 | DAQ_LINKAGE int daq_acquire_with_meta(const DAQ_Module_t *module, void *handle, int cnt, 71 | DAQ_Analysis_Func_t callback, DAQ_Meta_Func_t metaback, 72 | void *user); 73 | DAQ_LINKAGE int daq_inject(const DAQ_Module_t *module, void *handle, const DAQ_PktHdr_t *hdr, const uint8_t *packet_data, uint32_t len, int reverse); 74 | DAQ_LINKAGE int daq_breakloop(const DAQ_Module_t *module, void *handle); 75 | DAQ_LINKAGE int daq_stop(const DAQ_Module_t *module, void *handle); 76 | DAQ_LINKAGE int daq_shutdown(const DAQ_Module_t *module, void *handle); 77 | DAQ_LINKAGE DAQ_State daq_check_status(const DAQ_Module_t *module, void *handle); 78 | DAQ_LINKAGE int daq_get_stats(const DAQ_Module_t *module, void *handle, DAQ_Stats_t *stats); 79 | DAQ_LINKAGE void daq_reset_stats(const DAQ_Module_t *module, void *handle); 80 | DAQ_LINKAGE int daq_get_snaplen(const DAQ_Module_t *module, void *handle); 81 | DAQ_LINKAGE uint32_t daq_get_capabilities(const DAQ_Module_t *module, void *handle); 82 | DAQ_LINKAGE int daq_get_datalink_type(const DAQ_Module_t *module, void *handle); 83 | DAQ_LINKAGE const char *daq_get_error(const DAQ_Module_t *module, void *handle); 84 | DAQ_LINKAGE void daq_clear_error(const DAQ_Module_t *module, void *handle); 85 | DAQ_LINKAGE int daq_modify_flow(const DAQ_Module_t *module, void *handle, const DAQ_PktHdr_t *hdr, const DAQ_ModFlow_t *modify); 86 | DAQ_LINKAGE int daq_query_flow(const DAQ_Module_t *module, void *handle, const DAQ_PktHdr_t *hdr, DAQ_QueryFlow_t *query); 87 | DAQ_LINKAGE int daq_hup_prep(const DAQ_Module_t *module, void *handle, void **new_config); 88 | DAQ_LINKAGE int daq_hup_apply(const DAQ_Module_t *module, void *handle, void *new_config, void **old_config); 89 | DAQ_LINKAGE int daq_hup_post(const DAQ_Module_t *module, void *handle, void *old_config); 90 | DAQ_LINKAGE int daq_dp_add_dc(const DAQ_Module_t *module, void *handle, const DAQ_PktHdr_t *hdr, DAQ_DP_key_t *dp_key, 91 | const uint8_t *packet_data, DAQ_Data_Channel_Params_t *params); 92 | 93 | #endif /* _DAQ_H */ 94 | -------------------------------------------------------------------------------- /daq-2.2.1/api/daq_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved. 3 | ** Copyright (C) 2010-2013 Sourcefire, Inc. 4 | ** Author: Michael R. Altizer 5 | ** 6 | ** This program is free software; you can redistribute it and/or modify 7 | ** it under the terms of the GNU General Public License Version 2 as 8 | ** published by the Free Software Foundation. You may not use, modify or 9 | ** distribute this program under any other version of the GNU General 10 | ** Public License. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software 19 | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef _DAQ_API_H 23 | #define _DAQ_API_H 24 | 25 | #include 26 | 27 | struct _daq_dict_entry 28 | { 29 | char *key; 30 | char *value; 31 | struct _daq_dict_entry *next; 32 | }; 33 | 34 | struct _daq_module 35 | { 36 | /* The version of the API this module implements. 37 | This *must* be the first element in the structure. */ 38 | const uint32_t api_version; 39 | /* The version of the DAQ module itself - can be completely arbitrary. */ 40 | const uint32_t module_version; 41 | /* The name of the module (sfpacket, xvnim, pcap, etc.) */ 42 | const char *name; 43 | /* Various flags describing the module and its capabilities (Inline-capabale, etc.) */ 44 | const uint32_t type; 45 | /* Initialize the device for packet acquisition with the supplied configuration. 46 | This should not start queuing packets for the application. */ 47 | int (*initialize) (const DAQ_Config_t *config, void **ctxt_ptr, char *errbuf, size_t len); 48 | /* Set the module's BPF based on the given string */ 49 | int (*set_filter) (void *handle, const char *filter); 50 | /* Complete device opening and begin queuing packets if they have not been already. */ 51 | int (*start) (void *handle); 52 | /* Acquire up to packets and call for each with as the final argument. 53 | The return value of the callback will determine the action taken by the DAQ for each packet. 54 | If is 0, packets will continue to be acquired until some other factor breaks the 55 | acquisition loop. */ 56 | int (*acquire) (void *handle, int cnt, DAQ_Analysis_Func_t callback, DAQ_Meta_Func_t metaback, void *user); 57 | /* Inject a new packet going either the same or opposite direction as the specified packet. */ 58 | int (*inject) (void *handle, const DAQ_PktHdr_t *hdr, const uint8_t *packet_data, uint32_t len, int reverse); 59 | /* Force breaking out of the acquisition loop after the current iteration. */ 60 | int (*breakloop) (void *handle); 61 | /* Stop queuing packets, if possible */ 62 | int (*stop) (void *handle); 63 | /* Close the device and clean up */ 64 | void (*shutdown) (void *handle); 65 | /* Get the status of the module (one of DAQ_STATE_*). */ 66 | DAQ_State (*check_status) (void *handle); 67 | /* Populates the structure with the current DAQ stats. These stats are cumulative. */ 68 | int (*get_stats) (void *handle, DAQ_Stats_t *stats); 69 | /* Resets the DAQ module's internal stats. */ 70 | void (*reset_stats) (void *handle); 71 | /* Return the configured snaplen */ 72 | int (*get_snaplen) (void *handle); 73 | /* Return a bitfield of the device's capabilities */ 74 | uint32_t (*get_capabilities) (void *handle); 75 | /* Return the instance's Data Link Type */ 76 | int (*get_datalink_type) (void *handle); 77 | /* Return a pointer to the module's internal error buffer */ 78 | const char * (*get_errbuf) (void *handle); 79 | /* Write a string to the module instance's internal error buffer */ 80 | void (*set_errbuf) (void *handle, const char *string); 81 | /* Return the index of the given named device if possible. */ 82 | int (*get_device_index) (void *handle, const char *device); 83 | /* Modify a flow */ 84 | int (*modify_flow) (void *handle, const DAQ_PktHdr_t *hdr, const DAQ_ModFlow_t *modify); 85 | /* Read new configuration */ 86 | int (*hup_prep) (void *handle, void **new_config); 87 | /* Swap new and old configuration */ 88 | int (*hup_apply) (void *handle, void *new_config, void **old_config); 89 | /* Destroy old configuration */ 90 | int (*hup_post) (void *handle, void *old_config); 91 | /** DAQ API to program a FST/EFT entry for dynamic protocol data channel 92 | * 93 | * @param [in] handle DAQ module handle 94 | * @param [in] hdr DAQ packet header of the control channel packet. 95 | * @param [in] dp_key Key structure of the data channel flow 96 | * @param [in] packet_data Packet of the companion control channel packet. 97 | * @param [in] params Parameters to control the PST/EFT entry. 98 | * @return Error code of the API. 0 - success. 99 | */ 100 | int (*dp_add_dc) (void *handle, const DAQ_PktHdr_t *hdr, DAQ_DP_key_t *dp_key, 101 | const uint8_t *packet_data, DAQ_Data_Channel_Params_t *params); 102 | /* Query a flow */ 103 | int (*query_flow) (void *handle, const DAQ_PktHdr_t *hdr, DAQ_QueryFlow_t *query); 104 | }; 105 | 106 | #define DAQ_API_VERSION 0x00010006 107 | 108 | #define DAQ_ERRBUF_SIZE 256 109 | /* This is a convenience macro for safely printing to DAQ error buffers. It must be called on a known-size character array. */ 110 | 111 | #ifdef WIN32 112 | inline void DPE(char *var, char *fmt, ...) 113 | { 114 | va_list ap; 115 | va_start(ap, fmt); 116 | 117 | snprintf(var, sizeof(var), ap); 118 | 119 | va_end(ap); 120 | } 121 | #else 122 | #define DPE(var, ...) snprintf(var, sizeof(var), __VA_ARGS__) 123 | #endif 124 | 125 | #endif /* _DAQ_API_H */ 126 | -------------------------------------------------------------------------------- /daq-2.2.1/api/daq_mod_ops.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved. 2 | ** Copyright (C) 2010-2013 Sourcefire, Inc. 3 | ** Author: Michael R. Altizer 4 | ** 5 | ** This program is free software; you can redistribute it and/or modify 6 | ** it under the terms of the GNU General Public License Version 2 as 7 | ** published by the Free Software Foundation. You may not use, modify or 8 | ** distribute this program under any other version of the GNU General 9 | ** Public License. 10 | ** 11 | ** This program is distributed in the hope that it will be useful, 12 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ** GNU General Public License for more details. 15 | ** 16 | ** You should have received a copy of the GNU General Public License 17 | ** along with this program; if not, write to the Free Software 18 | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include "config.h" 23 | #endif 24 | 25 | #include 26 | #include "daq.h" 27 | #include "daq_api.h" 28 | 29 | /* 30 | * Functions that apply to instances of DAQ modules go here. 31 | */ 32 | DAQ_LINKAGE int daq_initialize(const DAQ_Module_t *module, const DAQ_Config_t *config, void **handle, char *errbuf, size_t len) 33 | { 34 | /* Don't do this. */ 35 | if (!errbuf) 36 | return DAQ_ERROR; 37 | 38 | if (!module) 39 | return DAQ_ERROR_NOMOD; 40 | 41 | if (!config) 42 | { 43 | snprintf(errbuf, len, "Can't initialize without a configuration!"); 44 | return DAQ_ERROR_INVAL; 45 | } 46 | 47 | if (!handle) 48 | { 49 | snprintf(errbuf, len, "Can't initialize without a context pointer!"); 50 | return DAQ_ERROR_INVAL; 51 | } 52 | 53 | if ((config->mode == DAQ_MODE_PASSIVE && !(module->type & DAQ_TYPE_INTF_CAPABLE)) || 54 | (config->mode == DAQ_MODE_INLINE && !(module->type & DAQ_TYPE_INLINE_CAPABLE)) || 55 | (config->mode == DAQ_MODE_READ_FILE && !(module->type & DAQ_TYPE_FILE_CAPABLE))) 56 | { 57 | snprintf(errbuf, len, "The %s DAQ module does not support %s mode!", module->name, daq_mode_string(config->mode)); 58 | return DAQ_ERROR_INVAL; 59 | } 60 | 61 | 62 | return module->initialize(config, handle, errbuf, len); 63 | } 64 | 65 | DAQ_LINKAGE int daq_set_filter(const DAQ_Module_t *module, void *handle, const char *filter) 66 | { 67 | if (!module) 68 | return DAQ_ERROR_NOMOD; 69 | 70 | if (!handle) 71 | return DAQ_ERROR_NOCTX; 72 | 73 | if (!filter) 74 | { 75 | module->set_errbuf(handle, "No filter string specified!"); 76 | return DAQ_ERROR_INVAL; 77 | } 78 | 79 | return module->set_filter(handle, filter); 80 | } 81 | 82 | DAQ_LINKAGE int daq_start(const DAQ_Module_t *module, void *handle) 83 | { 84 | if (!module) 85 | return DAQ_ERROR_NOMOD; 86 | 87 | if (!handle) 88 | return DAQ_ERROR_NOCTX; 89 | 90 | if (module->check_status(handle) != DAQ_STATE_INITIALIZED) 91 | { 92 | module->set_errbuf(handle, "Can't start an instance that isn't initialized!"); 93 | return DAQ_ERROR; 94 | } 95 | 96 | return module->start(handle); 97 | } 98 | 99 | DAQ_LINKAGE int daq_acquire(const DAQ_Module_t *module, void *handle, int cnt, 100 | DAQ_Analysis_Func_t callback, void *user) 101 | { 102 | if (!module) 103 | return DAQ_ERROR_NOMOD; 104 | 105 | if (!handle) 106 | return DAQ_ERROR_NOCTX; 107 | 108 | if (module->check_status(handle) != DAQ_STATE_STARTED) 109 | { 110 | module->set_errbuf(handle, "Can't acquire packets from an instance that isn't started!"); 111 | return DAQ_ERROR; 112 | } 113 | 114 | return module->acquire(handle, cnt, callback, NULL, user); 115 | } 116 | 117 | DAQ_LINKAGE int daq_acquire_with_meta(const DAQ_Module_t *module, void *handle, int cnt, 118 | DAQ_Analysis_Func_t callback, 119 | DAQ_Meta_Func_t metaback, void *user) 120 | { 121 | if (!module) 122 | return DAQ_ERROR_NOMOD; 123 | 124 | if (!handle) 125 | return DAQ_ERROR_NOCTX; 126 | 127 | if (module->check_status(handle) != DAQ_STATE_STARTED) 128 | { 129 | module->set_errbuf(handle, "Can't acquire packets from an instance that isn't started!"); 130 | return DAQ_ERROR; 131 | } 132 | 133 | return module->acquire(handle, cnt, callback, metaback, user); 134 | } 135 | 136 | DAQ_LINKAGE int daq_inject(const DAQ_Module_t *module, void *handle, const DAQ_PktHdr_t *hdr, const uint8_t *packet_data, uint32_t len, int reverse) 137 | { 138 | if (!module) 139 | return DAQ_ERROR_NOMOD; 140 | 141 | if (!handle) 142 | return DAQ_ERROR_NOCTX; 143 | 144 | if (!hdr) 145 | { 146 | module->set_errbuf(handle, "No originating packet header specified!"); 147 | return DAQ_ERROR_INVAL; 148 | } 149 | 150 | if (!packet_data) 151 | { 152 | module->set_errbuf(handle, "No packet data specified!"); 153 | return DAQ_ERROR_INVAL; 154 | } 155 | 156 | return module->inject(handle, hdr, packet_data, len, reverse); 157 | } 158 | 159 | DAQ_LINKAGE int daq_breakloop(const DAQ_Module_t *module, void *handle) 160 | { 161 | if (!module) 162 | return DAQ_ERROR_NOMOD; 163 | 164 | if (!handle) 165 | return DAQ_ERROR_NOCTX; 166 | 167 | return module->breakloop(handle); 168 | } 169 | 170 | DAQ_LINKAGE int daq_stop(const DAQ_Module_t *module, void *handle) 171 | { 172 | if (!module) 173 | return DAQ_ERROR_NOMOD; 174 | 175 | if (!handle) 176 | return DAQ_ERROR_NOCTX; 177 | 178 | if (module->check_status(handle) != DAQ_STATE_STARTED) 179 | { 180 | module->set_errbuf(handle, "Can't stop an instance that hasn't started!"); 181 | return DAQ_ERROR; 182 | } 183 | 184 | return module->stop(handle); 185 | } 186 | 187 | DAQ_LINKAGE int daq_shutdown(const DAQ_Module_t *module, void *handle) 188 | { 189 | if (!module) 190 | return DAQ_ERROR_NOMOD; 191 | if (!handle) 192 | return DAQ_ERROR_NOCTX; 193 | 194 | module->shutdown(handle); 195 | 196 | return DAQ_SUCCESS; 197 | } 198 | 199 | DAQ_LINKAGE DAQ_State daq_check_status(const DAQ_Module_t *module, void *handle) 200 | { 201 | if (!module || !handle) 202 | return DAQ_STATE_UNKNOWN; 203 | 204 | return module->check_status(handle); 205 | } 206 | 207 | DAQ_LINKAGE int daq_get_stats(const DAQ_Module_t *module, void *handle, DAQ_Stats_t *stats) 208 | { 209 | if (!module) 210 | return DAQ_ERROR_NOMOD; 211 | 212 | if (!handle) 213 | return DAQ_ERROR_NOCTX; 214 | 215 | if (!stats) 216 | { 217 | module->set_errbuf(handle, "No place to put the statistics!"); 218 | return DAQ_ERROR_INVAL; 219 | } 220 | 221 | return module->get_stats(handle, stats); 222 | } 223 | 224 | DAQ_LINKAGE void daq_reset_stats(const DAQ_Module_t *module, void *handle) 225 | { 226 | if (module && handle) 227 | module->reset_stats(handle); 228 | } 229 | 230 | DAQ_LINKAGE int daq_get_snaplen(const DAQ_Module_t *module, void *handle) 231 | { 232 | if (!module) 233 | return DAQ_ERROR_NOMOD; 234 | 235 | if (!handle) 236 | return DAQ_ERROR_NOCTX; 237 | 238 | return module->get_snaplen(handle); 239 | } 240 | 241 | DAQ_LINKAGE uint32_t daq_get_capabilities(const DAQ_Module_t *module, void *handle) 242 | { 243 | if (!module) 244 | return DAQ_ERROR_NOMOD; 245 | 246 | if (!handle) 247 | return DAQ_ERROR_NOCTX; 248 | 249 | return module->get_capabilities(handle); 250 | } 251 | 252 | DAQ_LINKAGE int daq_get_datalink_type(const DAQ_Module_t *module, void *handle) 253 | { 254 | if (!module) 255 | return DAQ_ERROR_NOMOD; 256 | 257 | if (!handle) 258 | return DAQ_ERROR_NOCTX; 259 | 260 | return module->get_datalink_type(handle); 261 | } 262 | 263 | DAQ_LINKAGE const char *daq_get_error(const DAQ_Module_t *module, void *handle) 264 | { 265 | if (!module || !handle) 266 | return NULL; 267 | 268 | return module->get_errbuf(handle); 269 | } 270 | 271 | DAQ_LINKAGE void daq_clear_error(const DAQ_Module_t *module, void *handle) 272 | { 273 | if (!module || !handle) 274 | return; 275 | 276 | module->set_errbuf(handle, ""); 277 | } 278 | 279 | DAQ_LINKAGE int daq_get_device_index(const DAQ_Module_t *module, void *handle, const char *device) 280 | { 281 | if (!module) 282 | return DAQ_ERROR_NOMOD; 283 | 284 | if (!handle) 285 | return DAQ_ERROR_NOCTX; 286 | 287 | if (!device) 288 | { 289 | module->set_errbuf(handle, "No device name to find the index of!"); 290 | return DAQ_ERROR_INVAL; 291 | } 292 | 293 | return module->get_device_index(handle, device); 294 | } 295 | 296 | DAQ_LINKAGE int daq_hup_prep(const DAQ_Module_t *module, void *handle, void **new_config) 297 | { 298 | if (!module) 299 | return DAQ_ERROR_NOMOD; 300 | 301 | if (!handle) 302 | return DAQ_ERROR_NOCTX; 303 | 304 | if (!module->hup_prep) 305 | { 306 | if (!module->hup_apply) 307 | return 1; 308 | return DAQ_SUCCESS; 309 | } 310 | 311 | return module->hup_prep(handle, new_config); 312 | } 313 | 314 | DAQ_LINKAGE int daq_hup_apply(const DAQ_Module_t *module, void *handle, void *new_config, void **old_config) 315 | { 316 | if (!module) 317 | return DAQ_ERROR_NOMOD; 318 | 319 | if (!handle) 320 | return DAQ_ERROR_NOCTX; 321 | 322 | if (!module->hup_apply) 323 | return DAQ_SUCCESS; 324 | 325 | return module->hup_apply(handle, new_config, old_config); 326 | } 327 | 328 | DAQ_LINKAGE int daq_hup_post(const DAQ_Module_t *module, void *handle, void *old_config) 329 | { 330 | if (!module) 331 | return DAQ_ERROR_NOMOD; 332 | 333 | if (!handle) 334 | return DAQ_ERROR_NOCTX; 335 | 336 | if (!module->hup_post) 337 | return DAQ_SUCCESS; 338 | 339 | return module->hup_post(handle, old_config); 340 | } 341 | 342 | DAQ_LINKAGE int daq_modify_flow(const DAQ_Module_t *module, void *handle, const DAQ_PktHdr_t *hdr, const DAQ_ModFlow_t *modify) 343 | { 344 | if (!module) 345 | return DAQ_ERROR_NOMOD; 346 | 347 | if (!module->modify_flow) 348 | return DAQ_SUCCESS; 349 | 350 | return module->modify_flow(handle, hdr, modify); 351 | } 352 | 353 | DAQ_LINKAGE int daq_query_flow(const DAQ_Module_t *module, void *handle, const DAQ_PktHdr_t *hdr, DAQ_QueryFlow_t *query) 354 | { 355 | if (!module) 356 | return DAQ_ERROR_NOMOD; 357 | 358 | if (!module->query_flow) 359 | return DAQ_SUCCESS; 360 | 361 | return module->query_flow(handle, hdr, query); 362 | } 363 | 364 | /* 365 | * Functions that apply to DAQ modules themselves go here. 366 | */ 367 | DAQ_LINKAGE const char *daq_get_name(const DAQ_Module_t *module) 368 | { 369 | if (!module) 370 | return NULL; 371 | 372 | return module->name; 373 | } 374 | 375 | DAQ_LINKAGE uint32_t daq_get_type(const DAQ_Module_t *module) 376 | { 377 | if (!module) 378 | return DAQ_ERROR_NOMOD; 379 | 380 | return module->type; 381 | } 382 | 383 | DAQ_LINKAGE int daq_dp_add_dc(const DAQ_Module_t *module, void *handle, const DAQ_PktHdr_t *hdr, 384 | DAQ_DP_key_t *dp_key, const uint8_t *packet_data, DAQ_Data_Channel_Params_t *params) 385 | { 386 | if (!module) 387 | return DAQ_ERROR_NOMOD; 388 | 389 | if (!handle) 390 | return DAQ_ERROR_NOCTX; 391 | 392 | if (!module->dp_add_dc) 393 | return DAQ_SUCCESS; 394 | 395 | return module->dp_add_dc(handle, hdr, dp_key, packet_data, params); 396 | } 397 | -------------------------------------------------------------------------------- /daq-2.2.1/api/daq_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (C) 2016 Sourcefire, Inc. 3 | ** Author: Michael R. Altizer 4 | ** 5 | ** This program is free software; you can redistribute it and/or modify 6 | ** it under the terms of the GNU General Public License Version 2 as 7 | ** published by the Free Software Foundation. You may not use, modify or 8 | ** distribute this program under any other version of the GNU General 9 | ** Public License. 10 | ** 11 | ** This program is distributed in the hope that it will be useful, 12 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ** GNU General Public License for more details. 15 | ** 16 | ** You should have received a copy of the GNU General Public License 17 | ** along with this program; if not, write to the Free Software 18 | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef _DAQ_VERSION_H 22 | #define _DAQ_VERSION_H 23 | 24 | #define DAQ_VERSION_MAJOR 2 25 | #define DAQ_VERSION_MINOR 2 26 | #define DAQ_VERSION_PATCH 1 27 | 28 | #define DAQ_VERSION_NUMERIC ((DAQ_VERSION_MAJOR << 24) | (DAQ_VERSION_MINOR << 16) | (DAQ_VERSION_PATCH << 8) | 0) 29 | 30 | #define DAQ_VERSION_STRING_C_(major, minor, patch) \ 31 | #major "." #minor "." #patch 32 | 33 | #define DAQ_VERSION_STRING_C(major, minor, patch) \ 34 | DAQ_VERSION_STRING_C_(major, minor, patch) 35 | 36 | #define DAQ_VERSION_STRING DAQ_VERSION_STRING_C( \ 37 | DAQ_VERSION_MAJOR, DAQ_VERSION_MINOR, \ 38 | DAQ_VERSION_PATCH) 39 | 40 | #endif /* _DAQ_VERSION_H */ 41 | -------------------------------------------------------------------------------- /daq-2.2.1/api/daq_version.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (C) 2016 Sourcefire, Inc. 3 | ** Author: Michael R. Altizer 4 | ** 5 | ** This program is free software; you can redistribute it and/or modify 6 | ** it under the terms of the GNU General Public License Version 2 as 7 | ** published by the Free Software Foundation. You may not use, modify or 8 | ** distribute this program under any other version of the GNU General 9 | ** Public License. 10 | ** 11 | ** This program is distributed in the hope that it will be useful, 12 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ** GNU General Public License for more details. 15 | ** 16 | ** You should have received a copy of the GNU General Public License 17 | ** along with this program; if not, write to the Free Software 18 | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef _DAQ_VERSION_H 22 | #define _DAQ_VERSION_H 23 | 24 | #define DAQ_VERSION_MAJOR @DAQ_MAJOR_VERSION@ 25 | #define DAQ_VERSION_MINOR @DAQ_MINOR_VERSION@ 26 | #define DAQ_VERSION_PATCH @DAQ_PATCH_VERSION@ 27 | 28 | #define DAQ_VERSION_NUMERIC ((DAQ_VERSION_MAJOR << 24) | (DAQ_VERSION_MINOR << 16) | (DAQ_VERSION_PATCH << 8) | 0) 29 | 30 | #define DAQ_VERSION_STRING_C_(major, minor, patch) \ 31 | #major "." #minor "." #patch 32 | 33 | #define DAQ_VERSION_STRING_C(major, minor, patch) \ 34 | DAQ_VERSION_STRING_C_(major, minor, patch) 35 | 36 | #define DAQ_VERSION_STRING DAQ_VERSION_STRING_C( \ 37 | DAQ_VERSION_MAJOR, DAQ_VERSION_MINOR, \ 38 | DAQ_VERSION_PATCH) 39 | 40 | #endif /* _DAQ_VERSION_H */ 41 | -------------------------------------------------------------------------------- /daq-2.2.1/compile: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Wrapper for compilers which do not understand '-c -o'. 3 | 4 | scriptversion=2012-10-14.11; # UTC 5 | 6 | # Copyright (C) 1999-2014 Free Software Foundation, Inc. 7 | # Written by Tom Tromey . 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | # This file is maintained in Automake, please report 28 | # bugs to or send patches to 29 | # . 30 | 31 | nl=' 32 | ' 33 | 34 | # We need space, tab and new line, in precisely that order. Quoting is 35 | # there to prevent tools from complaining about whitespace usage. 36 | IFS=" "" $nl" 37 | 38 | file_conv= 39 | 40 | # func_file_conv build_file lazy 41 | # Convert a $build file to $host form and store it in $file 42 | # Currently only supports Windows hosts. If the determined conversion 43 | # type is listed in (the comma separated) LAZY, no conversion will 44 | # take place. 45 | func_file_conv () 46 | { 47 | file=$1 48 | case $file in 49 | / | /[!/]*) # absolute file, and not a UNC file 50 | if test -z "$file_conv"; then 51 | # lazily determine how to convert abs files 52 | case `uname -s` in 53 | MINGW*) 54 | file_conv=mingw 55 | ;; 56 | CYGWIN*) 57 | file_conv=cygwin 58 | ;; 59 | *) 60 | file_conv=wine 61 | ;; 62 | esac 63 | fi 64 | case $file_conv/,$2, in 65 | *,$file_conv,*) 66 | ;; 67 | mingw/*) 68 | file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` 69 | ;; 70 | cygwin/*) 71 | file=`cygpath -m "$file" || echo "$file"` 72 | ;; 73 | wine/*) 74 | file=`winepath -w "$file" || echo "$file"` 75 | ;; 76 | esac 77 | ;; 78 | esac 79 | } 80 | 81 | # func_cl_dashL linkdir 82 | # Make cl look for libraries in LINKDIR 83 | func_cl_dashL () 84 | { 85 | func_file_conv "$1" 86 | if test -z "$lib_path"; then 87 | lib_path=$file 88 | else 89 | lib_path="$lib_path;$file" 90 | fi 91 | linker_opts="$linker_opts -LIBPATH:$file" 92 | } 93 | 94 | # func_cl_dashl library 95 | # Do a library search-path lookup for cl 96 | func_cl_dashl () 97 | { 98 | lib=$1 99 | found=no 100 | save_IFS=$IFS 101 | IFS=';' 102 | for dir in $lib_path $LIB 103 | do 104 | IFS=$save_IFS 105 | if $shared && test -f "$dir/$lib.dll.lib"; then 106 | found=yes 107 | lib=$dir/$lib.dll.lib 108 | break 109 | fi 110 | if test -f "$dir/$lib.lib"; then 111 | found=yes 112 | lib=$dir/$lib.lib 113 | break 114 | fi 115 | if test -f "$dir/lib$lib.a"; then 116 | found=yes 117 | lib=$dir/lib$lib.a 118 | break 119 | fi 120 | done 121 | IFS=$save_IFS 122 | 123 | if test "$found" != yes; then 124 | lib=$lib.lib 125 | fi 126 | } 127 | 128 | # func_cl_wrapper cl arg... 129 | # Adjust compile command to suit cl 130 | func_cl_wrapper () 131 | { 132 | # Assume a capable shell 133 | lib_path= 134 | shared=: 135 | linker_opts= 136 | for arg 137 | do 138 | if test -n "$eat"; then 139 | eat= 140 | else 141 | case $1 in 142 | -o) 143 | # configure might choose to run compile as 'compile cc -o foo foo.c'. 144 | eat=1 145 | case $2 in 146 | *.o | *.[oO][bB][jJ]) 147 | func_file_conv "$2" 148 | set x "$@" -Fo"$file" 149 | shift 150 | ;; 151 | *) 152 | func_file_conv "$2" 153 | set x "$@" -Fe"$file" 154 | shift 155 | ;; 156 | esac 157 | ;; 158 | -I) 159 | eat=1 160 | func_file_conv "$2" mingw 161 | set x "$@" -I"$file" 162 | shift 163 | ;; 164 | -I*) 165 | func_file_conv "${1#-I}" mingw 166 | set x "$@" -I"$file" 167 | shift 168 | ;; 169 | -l) 170 | eat=1 171 | func_cl_dashl "$2" 172 | set x "$@" "$lib" 173 | shift 174 | ;; 175 | -l*) 176 | func_cl_dashl "${1#-l}" 177 | set x "$@" "$lib" 178 | shift 179 | ;; 180 | -L) 181 | eat=1 182 | func_cl_dashL "$2" 183 | ;; 184 | -L*) 185 | func_cl_dashL "${1#-L}" 186 | ;; 187 | -static) 188 | shared=false 189 | ;; 190 | -Wl,*) 191 | arg=${1#-Wl,} 192 | save_ifs="$IFS"; IFS=',' 193 | for flag in $arg; do 194 | IFS="$save_ifs" 195 | linker_opts="$linker_opts $flag" 196 | done 197 | IFS="$save_ifs" 198 | ;; 199 | -Xlinker) 200 | eat=1 201 | linker_opts="$linker_opts $2" 202 | ;; 203 | -*) 204 | set x "$@" "$1" 205 | shift 206 | ;; 207 | *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) 208 | func_file_conv "$1" 209 | set x "$@" -Tp"$file" 210 | shift 211 | ;; 212 | *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) 213 | func_file_conv "$1" mingw 214 | set x "$@" "$file" 215 | shift 216 | ;; 217 | *) 218 | set x "$@" "$1" 219 | shift 220 | ;; 221 | esac 222 | fi 223 | shift 224 | done 225 | if test -n "$linker_opts"; then 226 | linker_opts="-link$linker_opts" 227 | fi 228 | exec "$@" $linker_opts 229 | exit 1 230 | } 231 | 232 | eat= 233 | 234 | case $1 in 235 | '') 236 | echo "$0: No command. Try '$0 --help' for more information." 1>&2 237 | exit 1; 238 | ;; 239 | -h | --h*) 240 | cat <<\EOF 241 | Usage: compile [--help] [--version] PROGRAM [ARGS] 242 | 243 | Wrapper for compilers which do not understand '-c -o'. 244 | Remove '-o dest.o' from ARGS, run PROGRAM with the remaining 245 | arguments, and rename the output as expected. 246 | 247 | If you are trying to build a whole package this is not the 248 | right script to run: please start by reading the file 'INSTALL'. 249 | 250 | Report bugs to . 251 | EOF 252 | exit $? 253 | ;; 254 | -v | --v*) 255 | echo "compile $scriptversion" 256 | exit $? 257 | ;; 258 | cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) 259 | func_cl_wrapper "$@" # Doesn't return... 260 | ;; 261 | esac 262 | 263 | ofile= 264 | cfile= 265 | 266 | for arg 267 | do 268 | if test -n "$eat"; then 269 | eat= 270 | else 271 | case $1 in 272 | -o) 273 | # configure might choose to run compile as 'compile cc -o foo foo.c'. 274 | # So we strip '-o arg' only if arg is an object. 275 | eat=1 276 | case $2 in 277 | *.o | *.obj) 278 | ofile=$2 279 | ;; 280 | *) 281 | set x "$@" -o "$2" 282 | shift 283 | ;; 284 | esac 285 | ;; 286 | *.c) 287 | cfile=$1 288 | set x "$@" "$1" 289 | shift 290 | ;; 291 | *) 292 | set x "$@" "$1" 293 | shift 294 | ;; 295 | esac 296 | fi 297 | shift 298 | done 299 | 300 | if test -z "$ofile" || test -z "$cfile"; then 301 | # If no '-o' option was seen then we might have been invoked from a 302 | # pattern rule where we don't need one. That is ok -- this is a 303 | # normal compilation that the losing compiler can handle. If no 304 | # '.c' file was seen then we are probably linking. That is also 305 | # ok. 306 | exec "$@" 307 | fi 308 | 309 | # Name of file we expect compiler to create. 310 | cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` 311 | 312 | # Create the lock directory. 313 | # Note: use '[/\\:.-]' here to ensure that we don't use the same name 314 | # that we are using for the .o file. Also, base the name on the expected 315 | # object file name, since that is what matters with a parallel build. 316 | lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d 317 | while true; do 318 | if mkdir "$lockdir" >/dev/null 2>&1; then 319 | break 320 | fi 321 | sleep 1 322 | done 323 | # FIXME: race condition here if user kills between mkdir and trap. 324 | trap "rmdir '$lockdir'; exit 1" 1 2 15 325 | 326 | # Run the compile. 327 | "$@" 328 | ret=$? 329 | 330 | if test -f "$cofile"; then 331 | test "$cofile" = "$ofile" || mv "$cofile" "$ofile" 332 | elif test -f "${cofile}bj"; then 333 | test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" 334 | fi 335 | 336 | rmdir "$lockdir" 337 | exit $ret 338 | 339 | # Local Variables: 340 | # mode: shell-script 341 | # sh-indentation: 2 342 | # eval: (add-hook 'write-file-hooks 'time-stamp) 343 | # time-stamp-start: "scriptversion=" 344 | # time-stamp-format: "%:y-%02m-%02d.%02H" 345 | # time-stamp-time-zone: "UTC" 346 | # time-stamp-end: "; # UTC" 347 | # End: 348 | -------------------------------------------------------------------------------- /daq-2.2.1/config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if you have the declaration of `PACKET_TX_RING', and to 0 if 4 | you don't. */ 5 | #undef HAVE_DECL_PACKET_TX_RING 6 | 7 | /* Define to 1 if you have the declaration of `TPACKET2_HDRLEN', and to 0 if 8 | you don't. */ 9 | #undef HAVE_DECL_TPACKET2_HDRLEN 10 | 11 | /* Define to 1 if you have the header file. */ 12 | #undef HAVE_DLFCN_H 13 | 14 | /* Define to 1 if you have the header file. */ 15 | #undef HAVE_DNET_H 16 | 17 | /* Define to 1 if you have the header file. */ 18 | #undef HAVE_DUMBNET_H 19 | 20 | /* Define to 1 if you have the `gethostbyname' function. */ 21 | #undef HAVE_GETHOSTBYNAME 22 | 23 | /* Define to 1 if you have the `getpagesize' function. */ 24 | #undef HAVE_GETPAGESIZE 25 | 26 | /* Define to 1 if you have the header file. */ 27 | #undef HAVE_INTTYPES_H 28 | 29 | /* Define to 1 if you have the `dnet' library (-ldnet). */ 30 | #undef HAVE_LIBDNET 31 | 32 | /* Define to 1 if you have the `dumbnet' library (-ldumbnet). */ 33 | #undef HAVE_LIBDUMBNET 34 | 35 | /* Define to 1 if you have the header file. */ 36 | #undef HAVE_LIBIPQ_H 37 | 38 | /* Define to 1 if you have the 39 | header file. */ 40 | #undef HAVE_LIBNETFILTER_QUEUE_LIBNETFILTER_QUEUE_H 41 | 42 | /* Define to 1 if you have the `pcap' library (-lpcap). */ 43 | #undef HAVE_LIBPCAP 44 | 45 | /* Define to 1 if you have the header file. */ 46 | #undef HAVE_LINUX_IF_ETHER_H 47 | 48 | /* Define to 1 if you have the header file. */ 49 | #undef HAVE_LINUX_IF_PACKET_H 50 | 51 | /* Define to 1 if your system has a GNU libc compatible `malloc' function, and 52 | to 0 otherwise. */ 53 | #undef HAVE_MALLOC 54 | 55 | /* Define to 1 if you have the header file. */ 56 | #undef HAVE_MEMORY_H 57 | 58 | /* Define to 1 if you have the `memset' function. */ 59 | #undef HAVE_MEMSET 60 | 61 | /* Define to 1 if you have a working `mmap' system call. */ 62 | #undef HAVE_MMAP 63 | 64 | /* Define to 1 if you have the `munmap' function. */ 65 | #undef HAVE_MUNMAP 66 | 67 | /* Define to 1 if you have the header file. */ 68 | #undef HAVE_NETDB_H 69 | 70 | /* Define to 1 if you have the header file. */ 71 | #undef HAVE_NETINET_IN_H 72 | 73 | /* Define to 1 if you have the header file. */ 74 | #undef HAVE_NET_NETMAP_H 75 | 76 | /* Define to 1 if you have the header file. */ 77 | #undef HAVE_NET_NETMAP_USER_H 78 | 79 | /* Define to 1 if you have the `socket' function. */ 80 | #undef HAVE_SOCKET 81 | 82 | /* Define to 1 if you have the header file. */ 83 | #undef HAVE_STDINT_H 84 | 85 | /* Define to 1 if you have the header file. */ 86 | #undef HAVE_STDLIB_H 87 | 88 | /* Define to 1 if you have the `strchr' function. */ 89 | #undef HAVE_STRCHR 90 | 91 | /* Define to 1 if you have the `strcspn' function. */ 92 | #undef HAVE_STRCSPN 93 | 94 | /* Define to 1 if you have the `strdup' function. */ 95 | #undef HAVE_STRDUP 96 | 97 | /* Define to 1 if you have the `strerror' function. */ 98 | #undef HAVE_STRERROR 99 | 100 | /* Define to 1 if you have the header file. */ 101 | #undef HAVE_STRINGS_H 102 | 103 | /* Define to 1 if you have the header file. */ 104 | #undef HAVE_STRING_H 105 | 106 | /* Define to 1 if you have the `strrchr' function. */ 107 | #undef HAVE_STRRCHR 108 | 109 | /* Define to 1 if you have the `strstr' function. */ 110 | #undef HAVE_STRSTR 111 | 112 | /* Define to 1 if you have the `strtoul' function. */ 113 | #undef HAVE_STRTOUL 114 | 115 | /* Define to 1 if you have the header file. */ 116 | #undef HAVE_SYS_IOCTL_H 117 | 118 | /* Define to 1 if you have the header file. */ 119 | #undef HAVE_SYS_PARAM_H 120 | 121 | /* Define to 1 if you have the header file. */ 122 | #undef HAVE_SYS_SOCKET_H 123 | 124 | /* Define to 1 if you have the header file. */ 125 | #undef HAVE_SYS_STAT_H 126 | 127 | /* Define to 1 if you have the header file. */ 128 | #undef HAVE_SYS_TIME_H 129 | 130 | /* Define to 1 if you have the header file. */ 131 | #undef HAVE_SYS_TYPES_H 132 | 133 | /* Define to 1 if you have the header file. */ 134 | #undef HAVE_UNISTD_H 135 | 136 | /* Define if the compiler supports visibility declarations. */ 137 | #undef HAVE_VISIBILITY 138 | 139 | /* System IPv6 support */ 140 | #undef INET6 141 | 142 | /* Define to the sub-directory where libtool stores uninstalled libraries. */ 143 | #undef LT_OBJDIR 144 | 145 | /* Name of package */ 146 | #undef PACKAGE 147 | 148 | /* Define to the address where bug reports for this package should be sent. */ 149 | #undef PACKAGE_BUGREPORT 150 | 151 | /* Define to the full name of this package. */ 152 | #undef PACKAGE_NAME 153 | 154 | /* Define to the full name and version of this package. */ 155 | #undef PACKAGE_STRING 156 | 157 | /* Define to the one symbol short name of this package. */ 158 | #undef PACKAGE_TARNAME 159 | 160 | /* Define to the home page for this package. */ 161 | #undef PACKAGE_URL 162 | 163 | /* Define to the version of this package. */ 164 | #undef PACKAGE_VERSION 165 | 166 | /* Define to 1 if you have the ANSI C header files. */ 167 | #undef STDC_HEADERS 168 | 169 | /* Version number of package */ 170 | #undef VERSION 171 | 172 | /* Define for Solaris 2.5.1 so the uint32_t typedef from , 173 | , or is not used. If the typedef were allowed, the 174 | #define below would cause a syntax error. */ 175 | #undef _UINT32_T 176 | 177 | /* Define for Solaris 2.5.1 so the uint64_t typedef from , 178 | , or is not used. If the typedef were allowed, the 179 | #define below would cause a syntax error. */ 180 | #undef _UINT64_T 181 | 182 | /* Define for Solaris 2.5.1 so the uint8_t typedef from , 183 | , or is not used. If the typedef were allowed, the 184 | #define below would cause a syntax error. */ 185 | #undef _UINT8_T 186 | 187 | /* Define to `__inline__' or `__inline' if that's what the C compiler 188 | calls it, or to nothing if 'inline' is not supported under any name. */ 189 | #ifndef __cplusplus 190 | #undef inline 191 | #endif 192 | 193 | /* Define to rpl_malloc if the replacement function should be used. */ 194 | #undef malloc 195 | 196 | /* Define to `unsigned int' if does not define. */ 197 | #undef size_t 198 | 199 | /* Define to the type of an unsigned integer type of width exactly 16 bits if 200 | such a type exists and the standard includes do not define it. */ 201 | #undef uint16_t 202 | 203 | /* Define to the type of an unsigned integer type of width exactly 32 bits if 204 | such a type exists and the standard includes do not define it. */ 205 | #undef uint32_t 206 | 207 | /* Define to the type of an unsigned integer type of width exactly 64 bits if 208 | such a type exists and the standard includes do not define it. */ 209 | #undef uint64_t 210 | 211 | /* Define to the type of an unsigned integer type of width exactly 8 bits if 212 | such a type exists and the standard includes do not define it. */ 213 | #undef uint8_t 214 | -------------------------------------------------------------------------------- /daq-2.2.1/daq.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="daq" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Static Library" 0x0104 6 | 7 | CFG=daq - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "daq.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "daq.mak" CFG="daq - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "daq - Win32 Release" (based on "Win32 (x86) Static Library") 21 | !MESSAGE "daq - Win32 Debug" (based on "Win32 (x86) Static Library") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "daq - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir "Release" 36 | # PROP BASE Intermediate_Dir "Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 2 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir "Release" 41 | # PROP Intermediate_Dir "Release" 42 | # PROP Target_Dir "" 43 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c 44 | # ADD CPP /nologo /MD /W3 /GX /O2 /I "api" /I "sfbpf" /I "../src/win32/WIN32-Includes" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "DAQ_DLL" /D "HAVE_CONFIG_H" /D "BUILD_PCAP_MODULE" /D "STATIC_MODULE_LIST" /D "_AFXDLL" /YX /FD /c 45 | # ADD BASE RSC /l 0x409 /d "NDEBUG" 46 | # ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" 47 | BSC32=bscmake.exe 48 | # ADD BASE BSC32 /nologo 49 | # ADD BSC32 /nologo 50 | LIB32=link.exe -lib 51 | # ADD BASE LIB32 /nologo 52 | # ADD LIB32 /nologo 53 | 54 | !ELSEIF "$(CFG)" == "daq - Win32 Debug" 55 | 56 | # PROP BASE Use_MFC 0 57 | # PROP BASE Use_Debug_Libraries 1 58 | # PROP BASE Output_Dir "Debug" 59 | # PROP BASE Intermediate_Dir "Debug" 60 | # PROP BASE Target_Dir "" 61 | # PROP Use_MFC 2 62 | # PROP Use_Debug_Libraries 1 63 | # PROP Output_Dir "Debug" 64 | # PROP Intermediate_Dir "Debug" 65 | # PROP Target_Dir "" 66 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c 67 | # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "api" /I "sfbpf" /I "../src/win32/WIN32-Includes" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "DAQ_DLL" /D "HAVE_CONFIG_H" /D "BUILD_PCAP_MODULE" /D "STATIC_MODULE_LIST" /D "_AFXDLL" /YX /FD /GZ /c 68 | # ADD BASE RSC /l 0x409 /d "_DEBUG" 69 | # ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" 70 | BSC32=bscmake.exe 71 | # ADD BASE BSC32 /nologo 72 | # ADD BSC32 /nologo 73 | LIB32=link.exe -lib 74 | # ADD BASE LIB32 /nologo 75 | # ADD LIB32 /nologo 76 | 77 | !ENDIF 78 | 79 | # Begin Target 80 | 81 | # Name "daq - Win32 Release" 82 | # Name "daq - Win32 Debug" 83 | # Begin Group "api" 84 | 85 | # PROP Default_Filter "" 86 | # Begin Source File 87 | 88 | SOURCE=.\api\daq.h 89 | # End Source File 90 | # Begin Source File 91 | 92 | SOURCE=.\api\daq_api.h 93 | # End Source File 94 | # Begin Source File 95 | 96 | SOURCE=.\api\daq_base.c 97 | # End Source File 98 | # Begin Source File 99 | 100 | SOURCE=.\api\daq_common.h 101 | # End Source File 102 | # Begin Source File 103 | 104 | SOURCE=.\api\daq_mod_ops.c 105 | # End Source File 106 | # End Group 107 | # Begin Group "sfbpf" 108 | 109 | # PROP Default_Filter "" 110 | # Begin Source File 111 | 112 | SOURCE=.\sfbpf\arcnet.h 113 | # End Source File 114 | # Begin Source File 115 | 116 | SOURCE=.\sfbpf\atmuni31.h 117 | # End Source File 118 | # Begin Source File 119 | 120 | SOURCE=.\sfbpf\bittypes.h 121 | # End Source File 122 | # Begin Source File 123 | 124 | SOURCE=.\sfbpf\ethertype.h 125 | # End Source File 126 | # Begin Source File 127 | 128 | SOURCE=.\sfbpf\gencode.h 129 | # End Source File 130 | # Begin Source File 131 | 132 | SOURCE=.\sfbpf\grammar.y 133 | 134 | !IF "$(CFG)" == "daq - Win32 Release" 135 | 136 | # Begin Custom Build 137 | InputPath=.\sfbpf\grammar.y 138 | InputName=grammar 139 | 140 | BuildCmds= \ 141 | c:\cygwin\bin\bison -d -psfbpf_lval -osfbpf/$(InputName).c sfbpf/$(InputName).y \ 142 | c:\cygwin\bin\mv sfbpf/$(InputName).h sfbpf/tokdefs.h \ 143 | 144 | 145 | "sfbpf/$(InputName).c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" 146 | $(BuildCmds) 147 | 148 | "sfbpf/tokdefs.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" 149 | $(BuildCmds) 150 | # End Custom Build 151 | 152 | !ELSEIF "$(CFG)" == "daq - Win32 Debug" 153 | 154 | # Begin Custom Build 155 | InputPath=.\sfbpf\grammar.y 156 | InputName=grammar 157 | 158 | BuildCmds= \ 159 | c:\cygwin\bin\bison -d -psfbpf_lval -osfbpf/$(InputName).c sfbpf/$(InputName).y \ 160 | c:\cygwin\bin\mv sfbpf/$(InputName).h sfbpf/tokdefs.h \ 161 | 162 | 163 | "sfbpf/$(InputName).c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" 164 | $(BuildCmds) 165 | 166 | "sfbpf/tokdefs.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" 167 | $(BuildCmds) 168 | # End Custom Build 169 | 170 | !ENDIF 171 | 172 | # End Source File 173 | # Begin Source File 174 | 175 | SOURCE=.\sfbpf\ieee80211.h 176 | # End Source File 177 | # Begin Source File 178 | 179 | SOURCE=.\sfbpf\IP6_misc.h 180 | # End Source File 181 | # Begin Source File 182 | 183 | SOURCE=.\sfbpf\ipnet.h 184 | # End Source File 185 | # Begin Source File 186 | 187 | SOURCE=.\sfbpf\llc.h 188 | # End Source File 189 | # Begin Source File 190 | 191 | SOURCE=.\sfbpf\namedb.h 192 | # End Source File 193 | # Begin Source File 194 | 195 | SOURCE=.\sfbpf\nlpid.h 196 | # End Source File 197 | # Begin Source File 198 | 199 | SOURCE=.\sfbpf\ppp.h 200 | # End Source File 201 | # Begin Source File 202 | 203 | SOURCE=.\sfbpf\scanner.l 204 | 205 | !IF "$(CFG)" == "daq - Win32 Release" 206 | 207 | # Begin Custom Build 208 | InputPath=.\sfbpf\scanner.l 209 | InputName=scanner 210 | 211 | "sfbpf/$(InputName).c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" 212 | c:\cygwin\bin\flex -i -Psfbpf_lval -osfbpf/$(InputName).c sfbpf/$(InputName).l 213 | 214 | # End Custom Build 215 | 216 | !ELSEIF "$(CFG)" == "daq - Win32 Debug" 217 | 218 | # Begin Custom Build 219 | InputPath=.\sfbpf\scanner.l 220 | InputName=scanner 221 | 222 | "sfbpf/$(InputName).c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" 223 | c:\cygwin\bin\flex -i -Psfbpf_lval -osfbpf/$(InputName).c sfbpf/$(InputName).l 224 | 225 | # End Custom Build 226 | 227 | !ENDIF 228 | 229 | # End Source File 230 | # Begin Source File 231 | 232 | SOURCE=".\sfbpf\sf-redefines.h" 233 | # End Source File 234 | # Begin Source File 235 | 236 | SOURCE=.\sfbpf\sf_bpf_filter.c 237 | # End Source File 238 | # Begin Source File 239 | 240 | SOURCE=.\sfbpf\sf_bpf_printer.c 241 | # End Source File 242 | # Begin Source File 243 | 244 | SOURCE=.\sfbpf\sf_gencode.c 245 | # End Source File 246 | # Begin Source File 247 | 248 | SOURCE=.\sfbpf\sf_nametoaddr.c 249 | # ADD CPP /I "../src/win32/WIN32-Includes/WinPCAP" 250 | # End Source File 251 | # Begin Source File 252 | 253 | SOURCE=.\sfbpf\sf_optimize.c 254 | # End Source File 255 | # Begin Source File 256 | 257 | SOURCE=".\sfbpf\sfbpf-int.c" 258 | # End Source File 259 | # Begin Source File 260 | 261 | SOURCE=".\sfbpf\sfbpf-int.h" 262 | # End Source File 263 | # Begin Source File 264 | 265 | SOURCE=.\sfbpf\sfbpf.h 266 | # End Source File 267 | # Begin Source File 268 | 269 | SOURCE=.\sfbpf\sfbpf_dlt.h 270 | # End Source File 271 | # Begin Source File 272 | 273 | SOURCE=.\sfbpf\sll.h 274 | # End Source File 275 | # Begin Source File 276 | 277 | SOURCE=.\sfbpf\sunatmpos.h 278 | # End Source File 279 | # Begin Source File 280 | 281 | SOURCE=".\sfbpf\win32-stdinc.h" 282 | # End Source File 283 | # End Group 284 | # Begin Group "os-daq-modules" 285 | 286 | # PROP Default_Filter "" 287 | # Begin Source File 288 | 289 | SOURCE=".\os-daq-modules\daq_pcap.c" 290 | # ADD CPP /I "../src/win32/WIN32-Includes/WinPCAP" 291 | # End Source File 292 | # Begin Source File 293 | 294 | SOURCE=".\os-daq-modules\daq_static_modules.c" 295 | # End Source File 296 | # Begin Source File 297 | 298 | SOURCE=".\os-daq-modules\daq_static_modules.h" 299 | # End Source File 300 | # End Group 301 | # End Target 302 | # End Project 303 | -------------------------------------------------------------------------------- /daq-2.2.1/m4/ax_check_compile_flag.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check whether the given FLAG works with the current language's compiler 12 | # or gives an error. (Warnings, however, are ignored) 13 | # 14 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on 15 | # success/failure. 16 | # 17 | # If EXTRA-FLAGS is defined, it is added to the current language's default 18 | # flags (e.g. CFLAGS) when the check is done. The check is thus made with 19 | # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to 20 | # force the compiler to issue an error when a bad flag is given. 21 | # 22 | # INPUT gives an alternative input source to AC_COMPILE_IFELSE. 23 | # 24 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this 25 | # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. 26 | # 27 | # LICENSE 28 | # 29 | # Copyright (c) 2008 Guido U. Draheim 30 | # Copyright (c) 2011 Maarten Bosmans 31 | # 32 | # This program is free software: you can redistribute it and/or modify it 33 | # under the terms of the GNU General Public License as published by the 34 | # Free Software Foundation, either version 3 of the License, or (at your 35 | # option) any later version. 36 | # 37 | # This program is distributed in the hope that it will be useful, but 38 | # WITHOUT ANY WARRANTY; without even the implied warranty of 39 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 40 | # Public License for more details. 41 | # 42 | # You should have received a copy of the GNU General Public License along 43 | # with this program. If not, see . 44 | # 45 | # As a special exception, the respective Autoconf Macro's copyright owner 46 | # gives unlimited permission to copy, distribute and modify the configure 47 | # scripts that are the output of Autoconf when processing the Macro. You 48 | # need not follow the terms of the GNU General Public License when using 49 | # or distributing such scripts, even though portions of the text of the 50 | # Macro appear in them. The GNU General Public License (GPL) does govern 51 | # all other use of the material that constitutes the Autoconf Macro. 52 | # 53 | # This special exception to the GPL applies to versions of the Autoconf 54 | # Macro released by the Autoconf Archive. When you make and distribute a 55 | # modified version of the Autoconf Macro, you may extend this special 56 | # exception to the GPL to apply to your modified version as well. 57 | 58 | #serial 4 59 | 60 | AC_DEFUN([AX_CHECK_COMPILE_FLAG], 61 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF 62 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl 63 | AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ 64 | ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS 65 | _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" 66 | AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], 67 | [AS_VAR_SET(CACHEVAR,[yes])], 68 | [AS_VAR_SET(CACHEVAR,[no])]) 69 | _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) 70 | AS_VAR_IF(CACHEVAR,yes, 71 | [m4_default([$2], :)], 72 | [m4_default([$3], :)]) 73 | AS_VAR_POPDEF([CACHEVAR])dnl 74 | ])dnl AX_CHECK_COMPILE_FLAGS 75 | -------------------------------------------------------------------------------- /daq-2.2.1/m4/ltsugar.m4: -------------------------------------------------------------------------------- 1 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software 4 | # Foundation, Inc. 5 | # Written by Gary V. Vaughan, 2004 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # serial 6 ltsugar.m4 12 | 13 | # This is to help aclocal find these macros, as it can't see m4_define. 14 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) 15 | 16 | 17 | # lt_join(SEP, ARG1, [ARG2...]) 18 | # ----------------------------- 19 | # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their 20 | # associated separator. 21 | # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier 22 | # versions in m4sugar had bugs. 23 | m4_define([lt_join], 24 | [m4_if([$#], [1], [], 25 | [$#], [2], [[$2]], 26 | [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) 27 | m4_define([_lt_join], 28 | [m4_if([$#$2], [2], [], 29 | [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) 30 | 31 | 32 | # lt_car(LIST) 33 | # lt_cdr(LIST) 34 | # ------------ 35 | # Manipulate m4 lists. 36 | # These macros are necessary as long as will still need to support 37 | # Autoconf-2.59, which quotes differently. 38 | m4_define([lt_car], [[$1]]) 39 | m4_define([lt_cdr], 40 | [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], 41 | [$#], 1, [], 42 | [m4_dquote(m4_shift($@))])]) 43 | m4_define([lt_unquote], $1) 44 | 45 | 46 | # lt_append(MACRO-NAME, STRING, [SEPARATOR]) 47 | # ------------------------------------------ 48 | # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. 49 | # Note that neither SEPARATOR nor STRING are expanded; they are appended 50 | # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). 51 | # No SEPARATOR is output if MACRO-NAME was previously undefined (different 52 | # than defined and empty). 53 | # 54 | # This macro is needed until we can rely on Autoconf 2.62, since earlier 55 | # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. 56 | m4_define([lt_append], 57 | [m4_define([$1], 58 | m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) 59 | 60 | 61 | 62 | # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) 63 | # ---------------------------------------------------------- 64 | # Produce a SEP delimited list of all paired combinations of elements of 65 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list 66 | # has the form PREFIXmINFIXSUFFIXn. 67 | # Needed until we can rely on m4_combine added in Autoconf 2.62. 68 | m4_define([lt_combine], 69 | [m4_if(m4_eval([$# > 3]), [1], 70 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl 71 | [[m4_foreach([_Lt_prefix], [$2], 72 | [m4_foreach([_Lt_suffix], 73 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, 74 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) 75 | 76 | 77 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) 78 | # ----------------------------------------------------------------------- 79 | # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited 80 | # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. 81 | m4_define([lt_if_append_uniq], 82 | [m4_ifdef([$1], 83 | [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], 84 | [lt_append([$1], [$2], [$3])$4], 85 | [$5])], 86 | [lt_append([$1], [$2], [$3])$4])]) 87 | 88 | 89 | # lt_dict_add(DICT, KEY, VALUE) 90 | # ----------------------------- 91 | m4_define([lt_dict_add], 92 | [m4_define([$1($2)], [$3])]) 93 | 94 | 95 | # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) 96 | # -------------------------------------------- 97 | m4_define([lt_dict_add_subkey], 98 | [m4_define([$1($2:$3)], [$4])]) 99 | 100 | 101 | # lt_dict_fetch(DICT, KEY, [SUBKEY]) 102 | # ---------------------------------- 103 | m4_define([lt_dict_fetch], 104 | [m4_ifval([$3], 105 | m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), 106 | m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) 107 | 108 | 109 | # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) 110 | # ----------------------------------------------------------------- 111 | m4_define([lt_if_dict_fetch], 112 | [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], 113 | [$5], 114 | [$6])]) 115 | 116 | 117 | # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) 118 | # -------------------------------------------------------------- 119 | m4_define([lt_dict_filter], 120 | [m4_if([$5], [], [], 121 | [lt_join(m4_quote(m4_default([$4], [[, ]])), 122 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), 123 | [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl 124 | ]) 125 | -------------------------------------------------------------------------------- /daq-2.2.1/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 4179 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.6]) 16 | m4_define([LT_PACKAGE_REVISION], [2.4.6]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.6' 20 | macro_revision='2.4.6' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /daq-2.2.1/m4/lt~obsolete.m4: -------------------------------------------------------------------------------- 1 | # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software 4 | # Foundation, Inc. 5 | # Written by Scott James Remnant, 2004. 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # serial 5 lt~obsolete.m4 12 | 13 | # These exist entirely to fool aclocal when bootstrapping libtool. 14 | # 15 | # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), 16 | # which have later been changed to m4_define as they aren't part of the 17 | # exported API, or moved to Autoconf or Automake where they belong. 18 | # 19 | # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN 20 | # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us 21 | # using a macro with the same name in our local m4/libtool.m4 it'll 22 | # pull the old libtool.m4 in (it doesn't see our shiny new m4_define 23 | # and doesn't know about Autoconf macros at all.) 24 | # 25 | # So we provide this file, which has a silly filename so it's always 26 | # included after everything else. This provides aclocal with the 27 | # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything 28 | # because those macros already exist, or will be overwritten later. 29 | # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 30 | # 31 | # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. 32 | # Yes, that means every name once taken will need to remain here until 33 | # we give up compatibility with versions before 1.7, at which point 34 | # we need to keep only those names which we still refer to. 35 | 36 | # This is to help aclocal find these macros, as it can't see m4_define. 37 | AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) 38 | 39 | m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) 40 | m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) 41 | m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) 42 | m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) 43 | m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) 44 | m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) 45 | m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) 46 | m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) 47 | m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) 48 | m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) 49 | m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) 50 | m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) 51 | m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) 52 | m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) 53 | m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) 54 | m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) 55 | m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) 56 | m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) 57 | m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) 58 | m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) 59 | m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) 60 | m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) 61 | m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) 62 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) 63 | m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) 64 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) 65 | m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) 66 | m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) 67 | m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) 68 | m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) 69 | m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) 70 | m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) 71 | m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) 72 | m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) 73 | m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) 74 | m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) 75 | m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) 76 | m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) 77 | m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) 78 | m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) 79 | m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) 80 | m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) 81 | m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) 82 | m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) 83 | m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) 84 | m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) 85 | m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) 86 | m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) 87 | m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) 88 | m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) 89 | m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) 90 | m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) 91 | m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) 92 | m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) 93 | m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) 94 | m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) 95 | m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) 96 | m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) 97 | m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) 98 | m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) 99 | m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) 100 | -------------------------------------------------------------------------------- /daq-2.2.1/m4/sf.m4: -------------------------------------------------------------------------------- 1 | dnl Enable visibility if we can 2 | dnl modified from gnulib/m4/visibility.m4 3 | AC_DEFUN([AC_ENABLE_VISIBILITY], 4 | [ 5 | AC_REQUIRE([AC_PROG_CC]) 6 | AC_MSG_CHECKING([for visibility support]) 7 | AC_CACHE_VAL(gl_cv_cc_visibility, [ 8 | gl_save_CFLAGS="$CFLAGS" 9 | # Add -Werror flag since some compilers, e.g. icc 7.1, don't support it, 10 | # but only warn about it instead of compilation failing 11 | CFLAGS="$CFLAGS -Werror -fvisibility=hidden" 12 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 13 | extern __attribute__((__visibility__("hidden"))) int hiddenvar; 14 | extern __attribute__((__visibility__("default"))) int exportedvar; 15 | extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); 16 | extern __attribute__((__visibility__("default"))) int exportedfunc (void);]], 17 | [[]])], 18 | [gl_cv_cc_visibility="yes"], 19 | [gl_cv_cc_visibility="no"]) 20 | ]) 21 | AC_MSG_RESULT([$gl_cv_cc_visibility]) 22 | if test "x$gl_cv_cc_visibility" = "xyes"; then 23 | CFLAGS="$gl_save_CFLAGS -fvisibility=hidden" 24 | AC_DEFINE([HAVE_VISIBILITY],[1], 25 | [Define if the compiler supports visibility declarations.]) 26 | else 27 | CFLAGS="$gl_save_CFLAGS" 28 | fi 29 | ]) 30 | 31 | dnl Special compiler flags for ICC 32 | dnl GCC strict CFLAGS 33 | AC_DEFUN([AC_SF_COMPILER_SETUP], 34 | [AC_REQUIRE([AC_PROG_CC]) 35 | ICC=no 36 | if eval "echo $CC | grep icc > /dev/null" ; then 37 | if eval "$CC -help | grep libcxa > /dev/null" ; then 38 | CFLAGS="$CFLAGS -static-libcxa" 39 | LDFLAGS="$LDFLAGS -static-libcxa" 40 | XCCFLAGS="-XCClinker -static-libcxa" 41 | else 42 | CFLAGS="$CFLAGS -static-intel" 43 | LDFLAGS="$LDFLAGS -static-intel" 44 | XCCFLAGS="-XCClinker -static-intel" 45 | fi 46 | CFLAGS=`echo $CFLAGS | sed 's/-O2/-O3/'` 47 | CFLAGS="$CFLAGS -ip -w1" 48 | ICC=yes 49 | GCC=no 50 | fi 51 | 52 | if test "$GCC" = yes ; then 53 | AX_CHECK_COMPILE_FLAG(-Wall, [AM_CFLAGS="${AM_CFLAGS} -Wall"]) 54 | AX_CHECK_COMPILE_FLAG(-Wwrite-strings, [AM_CFLAGS="${AM_CFLAGS} -Wwrite-strings"]) 55 | AX_CHECK_COMPILE_FLAG(-Wsign-compare, [AM_CFLAGS="${AM_CFLAGS} -Wsign-compare"]) 56 | AX_CHECK_COMPILE_FLAG(-Wcast-align, [AM_CFLAGS="${AM_CFLAGS} -Wcast-align"]) 57 | AX_CHECK_COMPILE_FLAG(-Wextra, [AM_CFLAGS="${AM_CFLAGS} -Wextra"]) 58 | AX_CHECK_COMPILE_FLAG(-Wformat, [AM_CFLAGS="${AM_CFLAGS} -Wformat"]) 59 | AX_CHECK_COMPILE_FLAG(-Wformat-security, [AM_CFLAGS="${AM_CFLAGS} -Wformat-security"]) 60 | AX_CHECK_COMPILE_FLAG(-Wno-unused-parameter, [AM_CFLAGS="${AM_CFLAGS} -Wno-unused-parameter"]) 61 | AX_CHECK_COMPILE_FLAG(-fno-strict-aliasing, [AM_CFLAGS="${AM_CFLAGS} -fno-strict-aliasing"]) 62 | AX_CHECK_COMPILE_FLAG(-fdiagnostics-show-option, [AM_CFLAGS="${AM_CFLAGS} -fdiagnostics-show-option"]) 63 | AX_CHECK_COMPILE_FLAG(-pedantic -std=c99 -D_GNU_SOURCE, [AM_CFLAGS="${AM_CFLAGS} --pedantic -std=c99 -D_GNU_SOURCE"]) 64 | fi 65 | ]) 66 | 67 | dnl 68 | dnl Check for flex, default to lex 69 | dnl Require flex 2.4 or higher 70 | dnl Check for bison, default to yacc 71 | dnl Default to lex/yacc if both flex and bison are not available 72 | dnl Define the yy prefix string if using flex and bison 73 | dnl 74 | dnl usage: 75 | dnl 76 | dnl AC_LBL_LEX_AND_YACC(lex, yacc, yyprefix) 77 | dnl 78 | dnl results: 79 | dnl 80 | dnl $1 (lex set) 81 | dnl $2 (yacc appended) 82 | dnl $3 (optional flex and bison -P prefix) 83 | dnl 84 | AC_DEFUN([AC_LBL_LEX_AND_YACC], 85 | [AC_ARG_WITH(flex, [ --without-flex don't use flex]) 86 | AC_ARG_WITH(bison, [ --without-bison don't use bison]) 87 | if test "$with_flex" = no ; then 88 | $1=lex 89 | else 90 | AC_CHECK_PROGS($1, flex, lex) 91 | fi 92 | if test "$$1" = flex ; then 93 | # The -V flag was added in 2.4 94 | AC_MSG_CHECKING(for flex 2.4 or higher) 95 | AC_CACHE_VAL(ac_cv_lbl_flex_v24, 96 | if flex -V >/dev/null 2>&1; then 97 | ac_cv_lbl_flex_v24=yes 98 | else 99 | ac_cv_lbl_flex_v24=no 100 | fi) 101 | AC_MSG_RESULT($ac_cv_lbl_flex_v24) 102 | if test $ac_cv_lbl_flex_v24 = no ; then 103 | s="2.4 or higher required" 104 | AC_MSG_WARN(ignoring obsolete flex executable ($s)) 105 | $1=lex 106 | fi 107 | fi 108 | if test "$with_bison" = no ; then 109 | $2=yacc 110 | else 111 | AC_CHECK_PROGS($2, bison, yacc) 112 | fi 113 | if test "$$2" = bison ; then 114 | $2="$$2 -y" 115 | fi 116 | if test "$$1" != lex -a "$$2" = yacc -o "$$1" = lex -a "$$2" != yacc ; then 117 | AC_MSG_WARN(don't have both flex and bison; reverting to lex/yacc) 118 | $1=lex 119 | $2=yacc 120 | fi 121 | if test "$$1" = flex -a -n "$3" ; then 122 | $1="$$1 -P$3" 123 | $2="$$2 -p $3" 124 | fi]) 125 | 126 | AC_DEFUN([AC_CHECK_PCAP_VER], 127 | [ 128 | AC_REQUIRE([AC_PROG_CC]) 129 | AC_MSG_CHECKING([for pcap_lib_version]) 130 | AC_CHECK_LIB([pcap],[pcap_lib_version],[LIBS="-lpcap ${LIBS}"],[have_pcap_lib_version="no"],[]) 131 | if test "x$have_pcap_lib_version" = "xno"; then 132 | echo 133 | echo " ERROR! Libpcap library version >= $1 not found." 134 | echo " Get it from http://www.tcpdump.org" 135 | echo 136 | exit 1 137 | fi 138 | AC_CACHE_CHECK([for libpcap version >= $1], [daq_cv_libpcap_version_1x], [ 139 | AC_RUN_IFELSE( 140 | [AC_LANG_PROGRAM( 141 | [[ 142 | #include 143 | #include 144 | extern char pcap_version[]; 145 | ]], 146 | [[ 147 | if (strcmp(pcap_version, $1) < 0) 148 | return 1; 149 | ]])], 150 | [daq_cv_libpcap_version_1x="yes"], 151 | [daq_cv_libpcap_version_1x="no"])]) 152 | if test "x$daq_cv_libpcap_version_1x" = "xno"; then 153 | echo 154 | echo " ERROR! Libpcap library version >= $1 not found." 155 | echo " Get it from http://www.tcpdump.org" 156 | echo 157 | exit 1 158 | fi 159 | ]) 160 | -------------------------------------------------------------------------------- /daq-2.2.1/missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common wrapper for a few potentially missing GNU programs. 3 | 4 | scriptversion=2013-10-28.13; # UTC 5 | 6 | # Copyright (C) 1996-2014 Free Software Foundation, Inc. 7 | # Originally written by Fran,cois Pinard , 1996. 8 | 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | if test $# -eq 0; then 28 | echo 1>&2 "Try '$0 --help' for more information" 29 | exit 1 30 | fi 31 | 32 | case $1 in 33 | 34 | --is-lightweight) 35 | # Used by our autoconf macros to check whether the available missing 36 | # script is modern enough. 37 | exit 0 38 | ;; 39 | 40 | --run) 41 | # Back-compat with the calling convention used by older automake. 42 | shift 43 | ;; 44 | 45 | -h|--h|--he|--hel|--help) 46 | echo "\ 47 | $0 [OPTION]... PROGRAM [ARGUMENT]... 48 | 49 | Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50 | to PROGRAM being missing or too old. 51 | 52 | Options: 53 | -h, --help display this help and exit 54 | -v, --version output version information and exit 55 | 56 | Supported PROGRAM values: 57 | aclocal autoconf autoheader autom4te automake makeinfo 58 | bison yacc flex lex help2man 59 | 60 | Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61 | 'g' are ignored when checking the name. 62 | 63 | Send bug reports to ." 64 | exit $? 65 | ;; 66 | 67 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68 | echo "missing $scriptversion (GNU Automake)" 69 | exit $? 70 | ;; 71 | 72 | -*) 73 | echo 1>&2 "$0: unknown '$1' option" 74 | echo 1>&2 "Try '$0 --help' for more information" 75 | exit 1 76 | ;; 77 | 78 | esac 79 | 80 | # Run the given program, remember its exit status. 81 | "$@"; st=$? 82 | 83 | # If it succeeded, we are done. 84 | test $st -eq 0 && exit 0 85 | 86 | # Also exit now if we it failed (or wasn't found), and '--version' was 87 | # passed; such an option is passed most likely to detect whether the 88 | # program is present and works. 89 | case $2 in --version|--help) exit $st;; esac 90 | 91 | # Exit code 63 means version mismatch. This often happens when the user 92 | # tries to use an ancient version of a tool on a file that requires a 93 | # minimum version. 94 | if test $st -eq 63; then 95 | msg="probably too old" 96 | elif test $st -eq 127; then 97 | # Program was missing. 98 | msg="missing on your system" 99 | else 100 | # Program was found and executed, but failed. Give up. 101 | exit $st 102 | fi 103 | 104 | perl_URL=http://www.perl.org/ 105 | flex_URL=http://flex.sourceforge.net/ 106 | gnu_software_URL=http://www.gnu.org/software 107 | 108 | program_details () 109 | { 110 | case $1 in 111 | aclocal|automake) 112 | echo "The '$1' program is part of the GNU Automake package:" 113 | echo "<$gnu_software_URL/automake>" 114 | echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115 | echo "<$gnu_software_URL/autoconf>" 116 | echo "<$gnu_software_URL/m4/>" 117 | echo "<$perl_URL>" 118 | ;; 119 | autoconf|autom4te|autoheader) 120 | echo "The '$1' program is part of the GNU Autoconf package:" 121 | echo "<$gnu_software_URL/autoconf/>" 122 | echo "It also requires GNU m4 and Perl in order to run:" 123 | echo "<$gnu_software_URL/m4/>" 124 | echo "<$perl_URL>" 125 | ;; 126 | esac 127 | } 128 | 129 | give_advice () 130 | { 131 | # Normalize program name to check for. 132 | normalized_program=`echo "$1" | sed ' 133 | s/^gnu-//; t 134 | s/^gnu//; t 135 | s/^g//; t'` 136 | 137 | printf '%s\n' "'$1' is $msg." 138 | 139 | configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140 | case $normalized_program in 141 | autoconf*) 142 | echo "You should only need it if you modified 'configure.ac'," 143 | echo "or m4 files included by it." 144 | program_details 'autoconf' 145 | ;; 146 | autoheader*) 147 | echo "You should only need it if you modified 'acconfig.h' or" 148 | echo "$configure_deps." 149 | program_details 'autoheader' 150 | ;; 151 | automake*) 152 | echo "You should only need it if you modified 'Makefile.am' or" 153 | echo "$configure_deps." 154 | program_details 'automake' 155 | ;; 156 | aclocal*) 157 | echo "You should only need it if you modified 'acinclude.m4' or" 158 | echo "$configure_deps." 159 | program_details 'aclocal' 160 | ;; 161 | autom4te*) 162 | echo "You might have modified some maintainer files that require" 163 | echo "the 'autom4te' program to be rebuilt." 164 | program_details 'autom4te' 165 | ;; 166 | bison*|yacc*) 167 | echo "You should only need it if you modified a '.y' file." 168 | echo "You may want to install the GNU Bison package:" 169 | echo "<$gnu_software_URL/bison/>" 170 | ;; 171 | lex*|flex*) 172 | echo "You should only need it if you modified a '.l' file." 173 | echo "You may want to install the Fast Lexical Analyzer package:" 174 | echo "<$flex_URL>" 175 | ;; 176 | help2man*) 177 | echo "You should only need it if you modified a dependency" \ 178 | "of a man page." 179 | echo "You may want to install the GNU Help2man package:" 180 | echo "<$gnu_software_URL/help2man/>" 181 | ;; 182 | makeinfo*) 183 | echo "You should only need it if you modified a '.texi' file, or" 184 | echo "any other file indirectly affecting the aspect of the manual." 185 | echo "You might want to install the Texinfo package:" 186 | echo "<$gnu_software_URL/texinfo/>" 187 | echo "The spurious makeinfo call might also be the consequence of" 188 | echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189 | echo "want to install GNU make:" 190 | echo "<$gnu_software_URL/make/>" 191 | ;; 192 | *) 193 | echo "You might have modified some files without having the proper" 194 | echo "tools for further handling them. Check the 'README' file, it" 195 | echo "often tells you about the needed prerequisites for installing" 196 | echo "this package. You may also peek at any GNU archive site, in" 197 | echo "case some other package contains this missing '$1' program." 198 | ;; 199 | esac 200 | } 201 | 202 | give_advice "$1" | sed -e '1s/^/WARNING: /' \ 203 | -e '2,$s/^/ /' >&2 204 | 205 | # Propagate the correct exit status (expected to be 127 for a program 206 | # not found, 63 for a program that failed due to version mismatch). 207 | exit $st 208 | 209 | # Local variables: 210 | # eval: (add-hook 'write-file-hooks 'time-stamp) 211 | # time-stamp-start: "scriptversion=" 212 | # time-stamp-format: "%:y-%02m-%02d.%02H" 213 | # time-stamp-time-zone: "UTC" 214 | # time-stamp-end: "; # UTC" 215 | # End: 216 | -------------------------------------------------------------------------------- /daq-2.2.1/os-daq-modules/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | 3 | ACLOCAL_AMFLAGS = -I m4 4 | 5 | bin_SCRIPTS = daq-modules-config 6 | 7 | pkglib_LTLIBRARIES = 8 | 9 | lib_LTLIBRARIES = libdaq_static_modules.la 10 | libdaq_static_modules_la_SOURCES = \ 11 | daq_static_modules.c \ 12 | daq_static_modules.h 13 | libdaq_static_modules_la_CFLAGS = $(AM_CFLAGS) 14 | libdaq_static_modules_la_LDFLAGS = -static -avoid-version 15 | libdaq_static_modules_la_LIBADD = 16 | 17 | if BUILD_AFPACKET_MODULE 18 | if BUILD_SHARED_MODULES 19 | pkglib_LTLIBRARIES += daq_afpacket.la 20 | daq_afpacket_la_SOURCES = daq_afpacket.c 21 | daq_afpacket_la_CFLAGS = $(AM_CFLAGS) -DBUILDING_SO 22 | daq_afpacket_la_LDFLAGS = -module -export-dynamic -avoid-version -shared @XCCFLAGS@ 23 | daq_afpacket_la_LIBADD = $(top_builddir)/sfbpf/libsfbpf.la 24 | endif 25 | libdaq_static_modules_la_SOURCES += daq_afpacket.c 26 | libdaq_static_modules_la_CFLAGS += -DBUILD_AFPACKET_MODULE 27 | endif 28 | 29 | if BUILD_PCAP_MODULE 30 | if BUILD_SHARED_MODULES 31 | pkglib_LTLIBRARIES += daq_pcap.la 32 | daq_pcap_la_SOURCES = daq_pcap.c 33 | daq_pcap_la_CFLAGS = $(AM_CFLAGS) -DBUILDING_SO 34 | daq_pcap_la_LDFLAGS = -module -export-dynamic -avoid-version -shared @XCCFLAGS@ 35 | daq_pcap_la_LIBADD = -lpcap 36 | endif 37 | libdaq_static_modules_la_SOURCES += daq_pcap.c 38 | libdaq_static_modules_la_CFLAGS += -DBUILD_PCAP_MODULE 39 | endif 40 | 41 | if BUILD_DPDK_MODULE 42 | if BUILD_SHARED_MODULES 43 | pkglib_LTLIBRARIES += daq_dpdk.la 44 | daq_dpdk_la_SOURCES = daq_dpdk.c 45 | daq_dpdk_la_CFLAGS = -DBUILDING_SO -msse4 46 | daq_dpdk_la_LDFLAGS = -module -export-dynamic -avoid-version -shared @XCCFLAGS@ 47 | daq_dpdk_la_LIBADD = $(top_builddir)/sfbpf/libsfbpf.la 48 | endif 49 | libdaq_static_modules_la_SOURCES += daq_dpdk.c 50 | libdaq_static_modules_la_CFLAGS += -DBUILD_DPDK_MODULE -msse4 51 | endif 52 | 53 | 54 | if BUILD_DUMP_MODULE 55 | if BUILD_SHARED_MODULES 56 | pkglib_LTLIBRARIES += daq_dump.la 57 | daq_dump_la_SOURCES = daq_dump.c 58 | daq_dump_la_CFLAGS = $(AM_CFLAGS) -DBUILDING_SO 59 | daq_dump_la_LDFLAGS = -module -export-dynamic -avoid-version -shared @XCCFLAGS@ 60 | daq_dump_la_LIBADD = -lpcap 61 | endif 62 | libdaq_static_modules_la_SOURCES += daq_dump.c 63 | libdaq_static_modules_la_CFLAGS += -DBUILD_DUMP_MODULE 64 | endif 65 | 66 | if BUILD_IPFW_MODULE 67 | if BUILD_SHARED_MODULES 68 | pkglib_LTLIBRARIES += daq_ipfw.la 69 | daq_ipfw_la_SOURCES = daq_ipfw.c 70 | daq_ipfw_la_CFLAGS = $(AM_CFLAGS) -DBUILDING_SO 71 | daq_ipfw_la_LDFLAGS = -module -export-dynamic -avoid-version -shared @XCCFLAGS@ 72 | daq_ipfw_la_LIBADD = $(top_builddir)/sfbpf/libsfbpf.la 73 | endif 74 | libdaq_static_modules_la_SOURCES += daq_ipfw.c 75 | libdaq_static_modules_la_CFLAGS += -DBUILD_IPFW_MODULE 76 | endif 77 | 78 | if BUILD_IPQ_MODULE 79 | if BUILD_SHARED_MODULES 80 | pkglib_LTLIBRARIES += daq_ipq.la 81 | daq_ipq_la_SOURCES = daq_ipq.c 82 | daq_ipq_la_CFLAGS = $(AM_CFLAGS) -DBUILDING_SO 83 | daq_ipq_la_LDFLAGS = -module -export-dynamic -avoid-version -shared @DNET_LDFLAGS@ @XCCFLAGS@ 84 | daq_ipq_la_LIBADD = -lipq @DNET_LDFLAGS@ $(top_builddir)/sfbpf/libsfbpf.la 85 | endif 86 | libdaq_static_modules_la_SOURCES += daq_ipq.c 87 | libdaq_static_modules_la_CFLAGS += -DBUILD_IPQ_MODULE 88 | endif 89 | 90 | if BUILD_NFQ_MODULE 91 | if BUILD_SHARED_MODULES 92 | pkglib_LTLIBRARIES += daq_nfq.la 93 | daq_nfq_la_SOURCES = daq_nfq.c 94 | daq_nfq_la_CFLAGS = $(AM_CFLAGS) -DBUILDING_SO 95 | daq_nfq_la_LDFLAGS = -module -export-dynamic -avoid-version -shared @DNET_LDFLAGS@ @XCCFLAGS@ 96 | daq_nfq_la_LIBADD = -lnfnetlink -lnetfilter_queue @DNET_LDFLAGS@ $(top_builddir)/sfbpf/libsfbpf.la 97 | endif 98 | libdaq_static_modules_la_SOURCES += daq_nfq.c 99 | libdaq_static_modules_la_CFLAGS += -DBUILD_NFQ_MODULE 100 | endif 101 | 102 | if BUILD_NETMAP_MODULE 103 | if BUILD_SHARED_MODULES 104 | pkglib_LTLIBRARIES += daq_netmap.la 105 | daq_netmap_la_SOURCES = daq_netmap.c 106 | daq_netmap_la_CFLAGS = $(AM_CFLAGS) -DBUILDING_SO 107 | daq_netmap_la_LDFLAGS = -module -export-dynamic -avoid-version -shared @XCCFLAGS@ 108 | daq_netmap_la_LIBADD = $(top_builddir)/sfbpf/libsfbpf.la 109 | endif 110 | libdaq_static_modules_la_SOURCES += daq_netmap.c 111 | libdaq_static_modules_la_CFLAGS += -DBUILD_NETMAP_MODULE 112 | endif 113 | 114 | AM_CPPFLAGS = -I$(top_srcdir)/api -I$(top_srcdir)/sfbpf -I$(top_builddir)/sfbpf 115 | 116 | EXTRA_DIST = daq-modules-config.in 117 | 118 | -------------------------------------------------------------------------------- /daq-2.2.1/os-daq-modules/daq-modules-config.in: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Script to give the appropriate compiler flags and linker flags 5 | # to use when building code that uses LibDAQ modules. 6 | # 7 | 8 | prefix=@prefix@ 9 | exec_prefix=@exec_prefix@ 10 | LIBDIR=@libdir@ 11 | STATIC_LIBS="@STATIC_LIBS@" 12 | 13 | static=0 14 | show_libs=0 15 | while [ "$#" != 0 ] 16 | do 17 | case "$1" in 18 | 19 | --static) 20 | static=1 21 | ;; 22 | 23 | --libs) 24 | show_libs=1 25 | ;; 26 | 27 | esac 28 | shift 29 | done 30 | 31 | if [ "$static" = 1 ] 32 | then 33 | # 34 | # Include LIBS so that the flags include libraries containing 35 | # routines that LibDAQ uses. 36 | # 37 | if [ "$show_libs" = 1 ] ; then 38 | echo "-L$LIBDIR -ldaq_static_modules $STATIC_LIBS" 39 | fi 40 | fi 41 | -------------------------------------------------------------------------------- /daq-2.2.1/os-daq-modules/daq_static_modules.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved. 3 | ** Copyright (C) 2010-2013 Sourcefire, Inc. 4 | ** Author: Michael R. Altizer 5 | ** 6 | ** This program is free software; you can redistribute it and/or modify 7 | ** it under the terms of the GNU General Public License Version 2 as 8 | ** published by the Free Software Foundation. You may not use, modify or 9 | ** distribute this program under any other version of the GNU General 10 | ** Public License. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software 19 | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include "daq_static_modules.h" 23 | 24 | const DAQ_Module_t *static_modules[] = 25 | { 26 | #ifdef BUILD_AFPACKET_MODULE 27 | &afpacket_daq_module_data, 28 | #endif 29 | #ifdef BUILD_DPDK_MODULE 30 | &dpdk_daq_module_data, 31 | #endif 32 | #ifdef BUILD_DUMP_MODULE 33 | &dump_daq_module_data, 34 | #endif 35 | #ifdef BUILD_IPFW_MODULE 36 | &ipfw_daq_module_data, 37 | #endif 38 | #ifdef BUILD_IPQ_MODULE 39 | &ipq_daq_module_data, 40 | #endif 41 | #ifdef BUILD_NFQ_MODULE 42 | &nfq_daq_module_data, 43 | #endif 44 | #ifdef BUILD_PCAP_MODULE 45 | &pcap_daq_module_data, 46 | #endif 47 | #ifdef BUILD_NETMAP_MODULE 48 | &netmap_daq_module_data, 49 | #endif 50 | }; 51 | const int num_static_modules = sizeof(static_modules) / sizeof(static_modules[0]); 52 | -------------------------------------------------------------------------------- /daq-2.2.1/os-daq-modules/daq_static_modules.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved. 3 | ** Copyright (C) 2010-2013 Sourcefire, Inc. 4 | ** Author: Michael R. Altizer 5 | ** 6 | ** This program is free software; you can redistribute it and/or modify 7 | ** it under the terms of the GNU General Public License Version 2 as 8 | ** published by the Free Software Foundation. You may not use, modify or 9 | ** distribute this program under any other version of the GNU General 10 | ** Public License. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software 19 | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include 23 | 24 | #ifdef BUILD_AFPACKET_MODULE 25 | extern const DAQ_Module_t afpacket_daq_module_data; 26 | #endif 27 | #ifdef BUILD_DPDK_MODULE 28 | extern const DAQ_Module_t dpdk_daq_module_data; 29 | #endif 30 | #ifdef BUILD_DUMP_MODULE 31 | extern const DAQ_Module_t dump_daq_module_data; 32 | #endif 33 | #ifdef BUILD_IPFW_MODULE 34 | extern const DAQ_Module_t ipfw_daq_module_data; 35 | #endif 36 | #ifdef BUILD_IPQ_MODULE 37 | extern const DAQ_Module_t ipq_daq_module_data; 38 | #endif 39 | #ifdef BUILD_NFQ_MODULE 40 | extern const DAQ_Module_t nfq_daq_module_data; 41 | #endif 42 | #ifdef BUILD_PCAP_MODULE 43 | extern const DAQ_Module_t pcap_daq_module_data; 44 | #endif 45 | #ifdef BUILD_NETMAP_MODULE 46 | extern const DAQ_Module_t netmap_daq_module_data; 47 | #endif 48 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/IP6_misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1993, 1994, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that: (1) source code distributions 7 | * retain the above copyright notice and this paragraph in its entirety, (2) 8 | * distributions including binary code include the above copyright notice and 9 | * this paragraph in its entirety in the documentation or other materials 10 | * provided with the distribution, and (3) all advertising materials mentioning 11 | * features or use of this software display the following acknowledgement: 12 | * ``This product includes software developed by the University of California, 13 | * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 | * the University nor the names of its contributors may be used to endorse 15 | * or promote products derived from this software without specific prior 16 | * written permission. 17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 | * 21 | */ 22 | 23 | /* 24 | * This file contains a collage of declarations for IPv6 from FreeBSD not present in Windows 25 | */ 26 | 27 | #include 28 | 29 | #include 30 | 31 | #ifndef __MINGW32__ 32 | #define IN_MULTICAST(a) IN_CLASSD(a) 33 | #endif 34 | 35 | #define IN_EXPERIMENTAL(a) ((((u_int32_t) (a)) & 0xf0000000) == 0xf0000000) 36 | 37 | #define IN_LOOPBACKNET 127 38 | 39 | #if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) 40 | /* IPv6 address */ 41 | struct in6_addr 42 | { 43 | union 44 | { 45 | u_int8_t u6_addr8[16]; 46 | u_int16_t u6_addr16[8]; 47 | u_int32_t u6_addr32[4]; 48 | } in6_u; 49 | #define s6_addr in6_u.u6_addr8 50 | #define s6_addr16 in6_u.u6_addr16 51 | #define s6_addr32 in6_u.u6_addr32 52 | #define s6_addr64 in6_u.u6_addr64 53 | }; 54 | 55 | #define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } 56 | #define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } 57 | #endif /* __MINGW32__ */ 58 | 59 | 60 | #if (defined _MSC_VER) || (defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF)) 61 | typedef unsigned short sa_family_t; 62 | #endif 63 | 64 | 65 | #if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) 66 | 67 | #define __SOCKADDR_COMMON(sa_prefix) \ 68 | sa_family_t sa_prefix##family 69 | 70 | /* Ditto, for IPv6. */ 71 | struct sockaddr_in6 72 | { 73 | __SOCKADDR_COMMON (sin6_); 74 | u_int16_t sin6_port; /* Transport layer port # */ 75 | u_int32_t sin6_flowinfo; /* IPv6 flow information */ 76 | struct in6_addr sin6_addr; /* IPv6 address */ 77 | }; 78 | 79 | #define IN6_IS_ADDR_V4MAPPED(a) \ 80 | ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \ 81 | (((u_int32_t *) (a))[2] == htonl (0xffff))) 82 | 83 | #define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff) 84 | 85 | #define IN6_IS_ADDR_LINKLOCAL(a) \ 86 | ((((u_int32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000)) 87 | 88 | #define IN6_IS_ADDR_LOOPBACK(a) \ 89 | (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \ 90 | ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1)) 91 | #endif /* __MINGW32__ */ 92 | 93 | #define ip6_vfc ip6_ctlun.ip6_un2_vfc 94 | #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow 95 | #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen 96 | #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt 97 | #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim 98 | #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim 99 | 100 | #define nd_rd_type nd_rd_hdr.icmp6_type 101 | #define nd_rd_code nd_rd_hdr.icmp6_code 102 | #define nd_rd_cksum nd_rd_hdr.icmp6_cksum 103 | #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] 104 | 105 | /* 106 | * IPV6 extension headers 107 | */ 108 | #define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ 109 | #define IPPROTO_IPV6 41 /* IPv6 header. */ 110 | #define IPPROTO_ROUTING 43 /* IPv6 routing header */ 111 | #define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ 112 | #define IPPROTO_ESP 50 /* encapsulating security payload */ 113 | #define IPPROTO_AH 51 /* authentication header */ 114 | #define IPPROTO_ICMPV6 58 /* ICMPv6 */ 115 | #define IPPROTO_NONE 59 /* IPv6 no next header */ 116 | #define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ 117 | #define IPPROTO_PIM 103 /* Protocol Independent Multicast. */ 118 | 119 | #define IPV6_RTHDR_TYPE_0 0 120 | 121 | /* Option types and related macros */ 122 | #define IP6OPT_PAD1 0x00 /* 00 0 00000 */ 123 | #define IP6OPT_PADN 0x01 /* 00 0 00001 */ 124 | #define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ 125 | #define IP6OPT_JUMBO_LEN 6 126 | #define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */ 127 | 128 | #define IP6OPT_RTALERT_LEN 4 129 | #define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ 130 | #define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ 131 | #define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ 132 | #define IP6OPT_MINLEN 2 133 | 134 | #define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */ 135 | #define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */ 136 | #define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */ 137 | #define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ 138 | #define IP6OPT_EID 0x8a /* 10 0 01010 */ 139 | 140 | #define IP6OPT_TYPE(o) ((o) & 0xC0) 141 | #define IP6OPT_TYPE_SKIP 0x00 142 | #define IP6OPT_TYPE_DISCARD 0x40 143 | #define IP6OPT_TYPE_FORCEICMP 0x80 144 | #define IP6OPT_TYPE_ICMP 0xC0 145 | 146 | #define IP6OPT_MUTABLE 0x20 147 | 148 | 149 | #if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) 150 | #ifndef EAI_ADDRFAMILY 151 | struct addrinfo { 152 | int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ 153 | int ai_family; /* PF_xxx */ 154 | int ai_socktype; /* SOCK_xxx */ 155 | int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ 156 | size_t ai_addrlen; /* length of ai_addr */ 157 | char *ai_canonname; /* canonical name for hostname */ 158 | struct sockaddr *ai_addr; /* binary address */ 159 | struct addrinfo *ai_next; /* next structure in linked list */ 160 | }; 161 | #endif 162 | #endif /* __MINGW32__ */ 163 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | 3 | ACLOCAL_AMFLAGS = -I m4 4 | 5 | lib_LTLIBRARIES = libsfbpf.la 6 | 7 | include_HEADERS = sfbpf.h sfbpf_dlt.h 8 | 9 | libsfbpf_la_SOURCES = \ 10 | arcnet.h \ 11 | atmuni31.h \ 12 | bittypes.h \ 13 | ethertype.h \ 14 | gencode.h \ 15 | ieee80211.h \ 16 | IP6_misc.h \ 17 | ipnet.h \ 18 | llc.h \ 19 | namedb.h \ 20 | nlpid.h \ 21 | ppp.h \ 22 | sfbpf.h \ 23 | sfbpf_dlt.h \ 24 | sf-redefines.h \ 25 | sf_bpf_filter.c \ 26 | sf_bpf_printer.c \ 27 | sf_gencode.c \ 28 | sf_nametoaddr.c \ 29 | sf_optimize.c \ 30 | sfbpf-int.c \ 31 | sll.h \ 32 | sunatmpos.h 33 | 34 | EXTRA_DIST = grammar.y scanner.l \ 35 | win32-stdinc.h \ 36 | sfbpf-int.h \ 37 | sfbpf-int.c \ 38 | runlex.sh 39 | 40 | nodist_libsfbpf_la_SOURCES = sf_grammar.c sf_scanner.c tokdefs.h 41 | 42 | libsfbpf_la_CFLAGS = $(AM_CFLAGS) -Dyylval=sfbpf_lval 43 | libsfbpf_la_LDFLAGS = -version-info 0:1:0 @XCCFLAGS@ 44 | 45 | # use of $@ and $< here is a GNU idiom that borks BSD 46 | sf_scanner.c: $(srcdir)/scanner.l 47 | @rm -f $(srcdir)/sf_scanner.c 48 | $(srcdir)/runlex.sh $(V_LEX) -osf_scanner.c $(srcdir)/scanner.l 49 | 50 | sf_scanner.o: sf_scanner.c tokdefs.h 51 | 52 | tokdefs.h: sf_grammar.c 53 | sf_grammar.c: $(srcdir)/grammar.y 54 | @rm -f sf_grammar.c tokdefs.h 55 | $(V_YACC) -d $(srcdir)/grammar.y 56 | mv y.tab.c sf_grammar.c 57 | mv y.tab.h tokdefs.h 58 | 59 | CLEANFILES = sf_scanner.c sf_grammar.c tokdefs.h sf_scanner.h 60 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/arcnet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1982, 1986, 1993 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by the University of 16 | * California, Berkeley and its contributors. 17 | * 4. Neither the name of the University nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | * 33 | * @(#) $Id$ (LBL) 34 | * 35 | * from: NetBSD: if_arc.h,v 1.13 1999/11/19 20:41:19 thorpej Exp 36 | */ 37 | 38 | /* RFC 1051 */ 39 | #define ARCTYPE_IP_OLD 240 /* IP protocol */ 40 | #define ARCTYPE_ARP_OLD 241 /* address resolution protocol */ 41 | 42 | /* RFC 1201 */ 43 | #define ARCTYPE_IP 212 /* IP protocol */ 44 | #define ARCTYPE_ARP 213 /* address resolution protocol */ 45 | #define ARCTYPE_REVARP 214 /* reverse addr resolution protocol */ 46 | 47 | #define ARCTYPE_ATALK 221 /* Appletalk */ 48 | #define ARCTYPE_BANIAN 247 /* Banyan Vines */ 49 | #define ARCTYPE_IPX 250 /* Novell IPX */ 50 | 51 | #define ARCTYPE_INET6 0xc4 /* IPng */ 52 | #define ARCTYPE_DIAGNOSE 0x80 /* as per ANSI/ATA 878.1 */ 53 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/atmuni31.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997 Yen Yen Lim and North Dakota State University 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by Yen Yen Lim and 16 | North Dakota State University 17 | * 4. The name of the author may not be used to endorse or promote products 18 | * derived from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 29 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | 34 | /* Based on UNI3.1 standard by ATM Forum */ 35 | 36 | /* ATM traffic types based on VPI=0 and (the following VCI */ 37 | #define VCI_PPC 0x05 /* Point-to-point signal msg */ 38 | #define VCI_BCC 0x02 /* Broadcast signal msg */ 39 | #define VCI_OAMF4SC 0x03 /* Segment OAM F4 flow cell */ 40 | #define VCI_OAMF4EC 0x04 /* End-to-end OAM F4 flow cell */ 41 | #define VCI_METAC 0x01 /* Meta signal msg */ 42 | #define VCI_ILMIC 0x10 /* ILMI msg */ 43 | 44 | /* Q.2931 signalling messages */ 45 | #define CALL_PROCEED 0x02 /* call proceeding */ 46 | #define CONNECT 0x07 /* connect */ 47 | #define CONNECT_ACK 0x0f /* connect_ack */ 48 | #define SETUP 0x05 /* setup */ 49 | #define RELEASE 0x4d /* release */ 50 | #define RELEASE_DONE 0x5a /* release_done */ 51 | #define RESTART 0x46 /* restart */ 52 | #define RESTART_ACK 0x4e /* restart ack */ 53 | #define STATUS 0x7d /* status */ 54 | #define STATUS_ENQ 0x75 /* status ack */ 55 | #define ADD_PARTY 0x80 /* add party */ 56 | #define ADD_PARTY_ACK 0x81 /* add party ack */ 57 | #define ADD_PARTY_REJ 0x82 /* add party rej */ 58 | #define DROP_PARTY 0x83 /* drop party */ 59 | #define DROP_PARTY_ACK 0x84 /* drop party ack */ 60 | 61 | /* Information Element Parameters in the signalling messages */ 62 | #define CAUSE 0x08 /* cause */ 63 | #define ENDPT_REF 0x54 /* endpoint reference */ 64 | #define AAL_PARA 0x58 /* ATM adaptation layer parameters */ 65 | #define TRAFF_DESCRIP 0x59 /* atm traffic descriptors */ 66 | #define CONNECT_ID 0x5a /* connection identifier */ 67 | #define QOS_PARA 0x5c /* quality of service parameters */ 68 | #define B_HIGHER 0x5d /* broadband higher layer information */ 69 | #define B_BEARER 0x5e /* broadband bearer capability */ 70 | #define B_LOWER 0x5f /* broadband lower information */ 71 | #define CALLING_PARTY 0x6c /* calling party number */ 72 | #define CALLED_PARTY 0x70 /* called party nmber */ 73 | 74 | #define Q2931 0x09 75 | 76 | /* Q.2931 signalling general messages format */ 77 | #define PROTO_POS 0 /* offset of protocol discriminator */ 78 | #define CALL_REF_POS 2 /* offset of call reference value */ 79 | #define MSG_TYPE_POS 5 /* offset of message type */ 80 | #define MSG_LEN_POS 7 /* offset of mesage length */ 81 | #define IE_BEGIN_POS 9 /* offset of first information element */ 82 | 83 | /* format of signalling messages */ 84 | #define TYPE_POS 0 85 | #define LEN_POS 2 86 | #define FIELD_BEGIN_POS 4 87 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/bittypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999 WIDE Project. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the project nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | */ 29 | #ifndef _BITTYPES_H 30 | #define _BITTYPES_H 31 | 32 | #ifndef HAVE_U_INT8_T 33 | 34 | #if SIZEOF_CHAR == 1 35 | typedef unsigned char u_int8_t; 36 | typedef signed char int8_t; 37 | #elif SIZEOF_INT == 1 38 | typedef unsigned int u_int8_t; 39 | typedef signed int int8_t; 40 | #else /* XXX */ 41 | #error "there's no appropriate type for u_int8_t" 42 | #endif 43 | #define HAVE_U_INT8_T 1 44 | #define HAVE_INT8_T 1 45 | 46 | #endif /* HAVE_U_INT8_T */ 47 | 48 | #ifndef HAVE_U_INT16_T 49 | 50 | #if SIZEOF_SHORT == 2 51 | typedef unsigned short u_int16_t; 52 | typedef signed short int16_t; 53 | #elif SIZEOF_INT == 2 54 | typedef unsigned int u_int16_t; 55 | typedef signed int int16_t; 56 | #elif SIZEOF_CHAR == 2 57 | typedef unsigned char u_int16_t; 58 | typedef signed char int16_t; 59 | #else /* XXX */ 60 | #error "there's no appropriate type for u_int16_t" 61 | #endif 62 | #define HAVE_U_INT16_T 1 63 | #define HAVE_INT16_T 1 64 | 65 | #endif /* HAVE_U_INT16_T */ 66 | 67 | #ifndef HAVE_U_INT32_T 68 | 69 | #if SIZEOF_INT == 4 70 | typedef unsigned int u_int32_t; 71 | typedef signed int int32_t; 72 | #elif SIZEOF_LONG == 4 73 | typedef unsigned long u_int32_t; 74 | typedef signed long int32_t; 75 | #elif SIZEOF_SHORT == 4 76 | typedef unsigned short u_int32_t; 77 | typedef signed short int32_t; 78 | #else /* XXX */ 79 | #error "there's no appropriate type for u_int32_t" 80 | #endif 81 | #define HAVE_U_INT32_T 1 82 | #define HAVE_INT32_T 1 83 | 84 | #endif /* HAVE_U_INT32_T */ 85 | 86 | #ifndef HAVE_U_INT64_T 87 | #if SIZEOF_LONG_LONG == 8 88 | typedef unsigned long long u_int64_t; 89 | typedef long long int64_t; 90 | #elif defined(_MSC_EXTENSIONS) 91 | typedef unsigned _int64 u_int64_t; 92 | typedef _int64 int64_t; 93 | #elif SIZEOF_INT == 8 94 | typedef unsigned int u_int64_t; 95 | #elif SIZEOF_LONG == 8 96 | typedef unsigned long u_int64_t; 97 | #elif SIZEOF_SHORT == 8 98 | typedef unsigned short u_int64_t; 99 | #else /* XXX */ 100 | #error "there's no appropriate type for u_int64_t" 101 | #endif 102 | #define HAVE_U_INT64_T 1 103 | #define HAVE_INT64_T 1 104 | 105 | #endif /* HAVE_U_INT64_T */ 106 | 107 | #ifndef PRId64 108 | #ifdef _MSC_EXTENSIONS 109 | #define PRId64 "I64d" 110 | #else /* _MSC_EXTENSIONS */ 111 | #define PRId64 "lld" 112 | #endif /* _MSC_EXTENSIONS */ 113 | #endif /* PRId64 */ 114 | 115 | #ifndef PRIo64 116 | #ifdef _MSC_EXTENSIONS 117 | #define PRIo64 "I64o" 118 | #else /* _MSC_EXTENSIONS */ 119 | #define PRIo64 "llo" 120 | #endif /* _MSC_EXTENSIONS */ 121 | #endif /* PRIo64 */ 122 | 123 | #ifndef PRIx64 124 | #ifdef _MSC_EXTENSIONS 125 | #define PRIx64 "I64x" 126 | #else /* _MSC_EXTENSIONS */ 127 | #define PRIx64 "llx" 128 | #endif /* _MSC_EXTENSIONS */ 129 | #endif /* PRIx64 */ 130 | 131 | #ifndef PRIu64 132 | #ifdef _MSC_EXTENSIONS 133 | #define PRIu64 "I64u" 134 | #else /* _MSC_EXTENSIONS */ 135 | #define PRIu64 "llu" 136 | #endif /* _MSC_EXTENSIONS */ 137 | #endif /* PRIu64 */ 138 | 139 | #endif /* _BITTYPES_H */ 140 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/ethertype.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1993, 1994, 1996 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that: (1) source code distributions 7 | * retain the above copyright notice and this paragraph in its entirety, (2) 8 | * distributions including binary code include the above copyright notice and 9 | * this paragraph in its entirety in the documentation or other materials 10 | * provided with the distribution, and (3) all advertising materials mentioning 11 | * features or use of this software display the following acknowledgement: 12 | * ``This product includes software developed by the University of California, 13 | * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 | * the University nor the names of its contributors may be used to endorse 15 | * or promote products derived from this software without specific prior 16 | * written permission. 17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 | * 21 | */ 22 | 23 | /* 24 | * Ethernet types. 25 | * 26 | * We wrap the declarations with #ifdef, so that if a file includes 27 | * , which may declare some of these, we don't 28 | * get a bunch of complaints from the C compiler about redefinitions 29 | * of these values. 30 | * 31 | * We declare all of them here so that no file has to include 32 | * if all it needs are ETHERTYPE_ values. 33 | */ 34 | 35 | #ifndef ETHERTYPE_PUP 36 | #define ETHERTYPE_PUP 0x0200 /* PUP protocol */ 37 | #endif 38 | #ifndef ETHERTYPE_IP 39 | #define ETHERTYPE_IP 0x0800 /* IP protocol */ 40 | #endif 41 | #ifndef ETHERTYPE_ARP 42 | #define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ 43 | #endif 44 | #ifndef ETHERTYPE_REVARP 45 | #define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */ 46 | #endif 47 | #ifndef ETHERTYPE_NS 48 | #define ETHERTYPE_NS 0x0600 49 | #endif 50 | #ifndef ETHERTYPE_SPRITE 51 | #define ETHERTYPE_SPRITE 0x0500 52 | #endif 53 | #ifndef ETHERTYPE_TRAIL 54 | #define ETHERTYPE_TRAIL 0x1000 55 | #endif 56 | #ifndef ETHERTYPE_MOPDL 57 | #define ETHERTYPE_MOPDL 0x6001 58 | #endif 59 | #ifndef ETHERTYPE_MOPRC 60 | #define ETHERTYPE_MOPRC 0x6002 61 | #endif 62 | #ifndef ETHERTYPE_DN 63 | #define ETHERTYPE_DN 0x6003 64 | #endif 65 | #ifndef ETHERTYPE_LAT 66 | #define ETHERTYPE_LAT 0x6004 67 | #endif 68 | #ifndef ETHERTYPE_SCA 69 | #define ETHERTYPE_SCA 0x6007 70 | #endif 71 | #ifndef ETHERTYPE_REVARP 72 | #define ETHERTYPE_REVARP 0x8035 73 | #endif 74 | #ifndef ETHERTYPE_LANBRIDGE 75 | #define ETHERTYPE_LANBRIDGE 0x8038 76 | #endif 77 | #ifndef ETHERTYPE_DECDNS 78 | #define ETHERTYPE_DECDNS 0x803c 79 | #endif 80 | #ifndef ETHERTYPE_DECDTS 81 | #define ETHERTYPE_DECDTS 0x803e 82 | #endif 83 | #ifndef ETHERTYPE_VEXP 84 | #define ETHERTYPE_VEXP 0x805b 85 | #endif 86 | #ifndef ETHERTYPE_VPROD 87 | #define ETHERTYPE_VPROD 0x805c 88 | #endif 89 | #ifndef ETHERTYPE_ATALK 90 | #define ETHERTYPE_ATALK 0x809b 91 | #endif 92 | #ifndef ETHERTYPE_AARP 93 | #define ETHERTYPE_AARP 0x80f3 94 | #endif 95 | #ifndef ETHERTYPE_8021Q 96 | #define ETHERTYPE_8021Q 0x8100 97 | #endif 98 | #ifndef ETHERTYPE_IPX 99 | #define ETHERTYPE_IPX 0x8137 100 | #endif 101 | #ifndef ETHERTYPE_IPV6 102 | #define ETHERTYPE_IPV6 0x86dd 103 | #endif 104 | #ifndef ETHERTYPE_MPLS 105 | #define ETHERTYPE_MPLS 0x8847 106 | #endif 107 | #ifndef ETHERTYPE_MPLS_MULTI 108 | #define ETHERTYPE_MPLS_MULTI 0x8848 109 | #endif 110 | #ifndef ETHERTYPE_PPPOED 111 | #define ETHERTYPE_PPPOED 0x8863 112 | #endif 113 | #ifndef ETHERTYPE_PPPOES 114 | #define ETHERTYPE_PPPOES 0x8864 115 | #endif 116 | #ifndef ETHERTYPE_LOOPBACK 117 | #define ETHERTYPE_LOOPBACK 0x9000 118 | #endif 119 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/gencode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that: (1) source code distributions 7 | * retain the above copyright notice and this paragraph in its entirety, (2) 8 | * distributions including binary code include the above copyright notice and 9 | * this paragraph in its entirety in the documentation or other materials 10 | * provided with the distribution, and (3) all advertising materials mentioning 11 | * features or use of this software display the following acknowledgement: 12 | * ``This product includes software developed by the University of California, 13 | * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 | * the University nor the names of its contributors may be used to endorse 15 | * or promote products derived from this software without specific prior 16 | * written permission. 17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 | * 21 | */ 22 | 23 | /* 24 | * ATM support: 25 | * 26 | * Copyright (c) 1997 Yen Yen Lim and North Dakota State University 27 | * All rights reserved. 28 | * 29 | * Redistribution and use in source and binary forms, with or without 30 | * modification, are permitted provided that the following conditions 31 | * are met: 32 | * 1. Redistributions of source code must retain the above copyright 33 | * notice, this list of conditions and the following disclaimer. 34 | * 2. Redistributions in binary form must reproduce the above copyright 35 | * notice, this list of conditions and the following disclaimer in the 36 | * documentation and/or other materials provided with the distribution. 37 | * 3. All advertising materials mentioning features or use of this software 38 | * must display the following acknowledgement: 39 | * This product includes software developed by Yen Yen Lim and 40 | * North Dakota State University 41 | * 4. The name of the author may not be used to endorse or promote products 42 | * derived from this software without specific prior written permission. 43 | * 44 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 45 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 46 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 47 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 48 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 49 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 50 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 51 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 52 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 53 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 54 | * POSSIBILITY OF SUCH DAMAGE. 55 | */ 56 | 57 | #include "sf-redefines.h" 58 | 59 | /* Address qualifiers. */ 60 | 61 | #define Q_HOST 1 62 | #define Q_NET 2 63 | #define Q_PORT 3 64 | #define Q_GATEWAY 4 65 | #define Q_PROTO 5 66 | #define Q_PROTOCHAIN 6 67 | #define Q_PORTRANGE 7 68 | 69 | /* Protocol qualifiers. */ 70 | 71 | #define Q_LINK 1 72 | #define Q_IP 2 73 | #define Q_ARP 3 74 | #define Q_RARP 4 75 | #define Q_SCTP 5 76 | #define Q_TCP 6 77 | #define Q_UDP 7 78 | #define Q_ICMP 8 79 | #define Q_IGMP 9 80 | #define Q_IGRP 10 81 | 82 | 83 | #define Q_ATALK 11 84 | #define Q_DECNET 12 85 | #define Q_LAT 13 86 | #define Q_SCA 14 87 | #define Q_MOPRC 15 88 | #define Q_MOPDL 16 89 | 90 | 91 | #define Q_IPV6 17 92 | #define Q_ICMPV6 18 93 | #define Q_AH 19 94 | #define Q_ESP 20 95 | 96 | #define Q_PIM 21 97 | #define Q_VRRP 22 98 | 99 | #define Q_AARP 23 100 | 101 | #define Q_ISO 24 102 | #define Q_ESIS 25 103 | #define Q_ISIS 26 104 | #define Q_CLNP 27 105 | 106 | #define Q_STP 28 107 | 108 | #define Q_IPX 29 109 | 110 | #define Q_NETBEUI 30 111 | 112 | /* IS-IS Levels */ 113 | #define Q_ISIS_L1 31 114 | #define Q_ISIS_L2 32 115 | /* PDU types */ 116 | #define Q_ISIS_IIH 33 117 | #define Q_ISIS_LAN_IIH 34 118 | #define Q_ISIS_PTP_IIH 35 119 | #define Q_ISIS_SNP 36 120 | #define Q_ISIS_CSNP 37 121 | #define Q_ISIS_PSNP 38 122 | #define Q_ISIS_LSP 39 123 | 124 | #define Q_RADIO 40 125 | 126 | /* Directional qualifiers. */ 127 | 128 | #define Q_SRC 1 129 | #define Q_DST 2 130 | #define Q_OR 3 131 | #define Q_AND 4 132 | #define Q_ADDR1 5 133 | #define Q_ADDR2 6 134 | #define Q_ADDR3 7 135 | #define Q_ADDR4 8 136 | 137 | #define Q_DEFAULT 0 138 | #define Q_UNDEF 255 139 | 140 | /* ATM types */ 141 | #define A_METAC 22 /* Meta signalling Circuit */ 142 | #define A_BCC 23 /* Broadcast Circuit */ 143 | #define A_OAMF4SC 24 /* Segment OAM F4 Circuit */ 144 | #define A_OAMF4EC 25 /* End-to-End OAM F4 Circuit */ 145 | #define A_SC 26 /* Signalling Circuit */ 146 | #define A_ILMIC 27 /* ILMI Circuit */ 147 | #define A_OAM 28 /* OAM cells : F4 only */ 148 | #define A_OAMF4 29 /* OAM F4 cells: Segment + End-to-end */ 149 | #define A_LANE 30 /* LANE traffic */ 150 | #define A_LLC 31 /* LLC-encapsulated traffic */ 151 | 152 | /* Based on Q.2931 signalling protocol */ 153 | #define A_SETUP 41 /* Setup message */ 154 | #define A_CALLPROCEED 42 /* Call proceeding message */ 155 | #define A_CONNECT 43 /* Connect message */ 156 | #define A_CONNECTACK 44 /* Connect Ack message */ 157 | #define A_RELEASE 45 /* Release message */ 158 | #define A_RELEASE_DONE 46 /* Release message */ 159 | 160 | /* ATM field types */ 161 | #define A_VPI 51 162 | #define A_VCI 52 163 | #define A_PROTOTYPE 53 164 | #define A_MSGTYPE 54 165 | #define A_CALLREFTYPE 55 166 | 167 | #define A_CONNECTMSG 70 /* returns Q.2931 signalling messages for 168 | establishing and destroying switched 169 | virtual connection */ 170 | #define A_METACONNECT 71 /* returns Q.2931 signalling messages for 171 | establishing and destroying predefined 172 | virtual circuits, such as broadcast 173 | circuit, oamf4 segment circuit, oamf4 174 | end-to-end circuits, ILMI circuits or 175 | connection signalling circuit. */ 176 | 177 | /* MTP2 types */ 178 | #define M_FISU 22 /* FISU */ 179 | #define M_LSSU 23 /* LSSU */ 180 | #define M_MSU 24 /* MSU */ 181 | 182 | /* MTP3 field types */ 183 | #define M_SIO 1 184 | #define M_OPC 2 185 | #define M_DPC 3 186 | #define M_SLS 4 187 | 188 | 189 | struct slist; 190 | 191 | struct stmt 192 | { 193 | int code; 194 | struct slist *jt; /*only for relative jump in block */ 195 | struct slist *jf; /*only for relative jump in block */ 196 | bpf_int32 k; 197 | }; 198 | 199 | struct slist 200 | { 201 | struct stmt s; 202 | struct slist *next; 203 | }; 204 | 205 | /* 206 | * A bit vector to represent definition sets. We assume TOT_REGISTERS 207 | * is smaller than 8*sizeof(atomset). 208 | */ 209 | typedef bpf_u_int32 atomset; 210 | #define ATOMMASK(n) (1 << (n)) 211 | #define ATOMELEM(d, n) (d & ATOMMASK(n)) 212 | 213 | /* 214 | * An unbounded set. 215 | */ 216 | typedef bpf_u_int32 *uset; 217 | 218 | /* 219 | * Total number of atomic entities, including accumulator (A) and index (X). 220 | * We treat all these guys similarly during flow analysis. 221 | */ 222 | #define N_ATOMS (BPF_MEMWORDS+2) 223 | 224 | struct edge 225 | { 226 | int id; 227 | int code; 228 | uset edom; 229 | struct block *succ; 230 | struct block *pred; 231 | struct edge *next; /* link list of incoming edges for a node */ 232 | }; 233 | 234 | struct block 235 | { 236 | int id; 237 | struct slist *stmts; /* side effect stmts */ 238 | struct stmt s; /* branch stmt */ 239 | int mark; 240 | int longjt; /* jt branch requires long jump */ 241 | int longjf; /* jf branch requires long jump */ 242 | int level; 243 | int offset; 244 | int sense; 245 | struct edge et; 246 | struct edge ef; 247 | struct block *head; 248 | struct block *link; /* link field used by optimizer */ 249 | uset dom; 250 | uset closure; 251 | struct edge *in_edges; 252 | atomset def, kill; 253 | atomset in_use; 254 | atomset out_use; 255 | int oval; 256 | int val[N_ATOMS]; 257 | }; 258 | 259 | struct arth 260 | { 261 | struct block *b; /* protocol checks */ 262 | struct slist *s; /* stmt list */ 263 | int regno; /* virtual register number of result */ 264 | }; 265 | 266 | struct qual 267 | { 268 | unsigned char addr; 269 | unsigned char proto; 270 | unsigned char dir; 271 | unsigned char pad; 272 | }; 273 | 274 | struct arth *gen_loadi(int); 275 | struct arth *gen_load(int, struct arth *, int); 276 | struct arth *gen_loadlen(void); 277 | struct arth *gen_neg(struct arth *); 278 | struct arth *gen_arth(int, struct arth *, struct arth *); 279 | 280 | void gen_and(struct block *, struct block *); 281 | void gen_or(struct block *, struct block *); 282 | void gen_not(struct block *); 283 | 284 | struct block *gen_scode(const char *, struct qual); 285 | struct block *gen_ecode(const u_char *, struct qual); 286 | struct block *gen_acode(const u_char *, struct qual); 287 | struct block *gen_mcode(const char *, const char *, int, struct qual); 288 | #ifdef INET6 289 | struct block *gen_mcode6(const char *, const char *, int, struct qual); 290 | #endif 291 | struct block *gen_ncode(const char *, bpf_u_int32, struct qual); 292 | struct block *gen_proto_abbrev(int); 293 | struct block *gen_relation(int, struct arth *, struct arth *, int); 294 | struct block *gen_less(int); 295 | struct block *gen_greater(int); 296 | struct block *gen_byteop(int, int, int); 297 | struct block *gen_broadcast(int); 298 | struct block *gen_multicast(int); 299 | struct block *gen_inbound(int); 300 | 301 | struct block *gen_vlan(int); 302 | struct block *gen_mpls(int); 303 | 304 | struct block *gen_pppoed(void); 305 | struct block *gen_pppoes(void); 306 | 307 | struct block *gen_atmfield_code(int atmfield, bpf_int32 jvalue, bpf_u_int32 jtype, int reverse); 308 | struct block *gen_atmtype_abbrev(int type); 309 | struct block *gen_atmmulti_abbrev(int type); 310 | 311 | struct block *gen_mtp2type_abbrev(int type); 312 | struct block *gen_mtp3field_code(int mtp3field, bpf_u_int32 jvalue, bpf_u_int32 jtype, int reverse); 313 | 314 | struct block *gen_pf_ifname(const char *); 315 | struct block *gen_pf_rnr(int); 316 | struct block *gen_pf_srnr(int); 317 | struct block *gen_pf_ruleset(char *); 318 | struct block *gen_pf_reason(int); 319 | struct block *gen_pf_action(int); 320 | struct block *gen_pf_dir(int); 321 | 322 | struct block *gen_p80211_type(int, int); 323 | struct block *gen_p80211_fcdir(int); 324 | 325 | void bpf_optimize(struct block **); 326 | #ifndef WIN32 327 | void bpf_error(const char *, ...) __attribute__ ((noreturn, format(printf, 1, 2))); 328 | #else 329 | __declspec(noreturn) void bpf_error(const char *, ...); 330 | #endif 331 | 332 | void finish_parse(struct block *); 333 | char *sdup(const char *); 334 | 335 | struct bpf_insn *icode_to_fcode(struct block *, int *); 336 | int pcap_parse(void); 337 | void lex_init(const char *); 338 | void lex_cleanup(void); 339 | void sappend(struct slist *, struct slist *); 340 | 341 | /* XXX */ 342 | #define JT(b) ((b)->et.succ) 343 | #define JF(b) ((b)->ef.succ) 344 | 345 | extern int no_optimize; 346 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/ieee80211.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2001 Atsushi Onoe 3 | * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * Alternatively, this software may be distributed under the terms of the 18 | * GNU General Public License ("GPL") version 2 as published by the Free 19 | * Software Foundation. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | * $FreeBSD: src/sys/net80211/ieee80211.h,v 1.10 2005/07/22 16:55:27 sam Exp $ 33 | */ 34 | #ifndef _NET80211_IEEE80211_H_ 35 | #define _NET80211_IEEE80211_H_ 36 | 37 | /* 38 | * 802.11 protocol definitions. 39 | */ 40 | 41 | #define IEEE80211_FC0_VERSION_MASK 0x03 42 | #define IEEE80211_FC0_VERSION_SHIFT 0 43 | #define IEEE80211_FC0_VERSION_0 0x00 44 | #define IEEE80211_FC0_TYPE_MASK 0x0c 45 | #define IEEE80211_FC0_TYPE_SHIFT 2 46 | #define IEEE80211_FC0_TYPE_MGT 0x00 47 | #define IEEE80211_FC0_TYPE_CTL 0x04 48 | #define IEEE80211_FC0_TYPE_DATA 0x08 49 | 50 | #define IEEE80211_FC0_SUBTYPE_MASK 0xf0 51 | #define IEEE80211_FC0_SUBTYPE_SHIFT 4 52 | /* for TYPE_MGT */ 53 | #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00 54 | #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10 55 | #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20 56 | #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30 57 | #define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40 58 | #define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50 59 | #define IEEE80211_FC0_SUBTYPE_BEACON 0x80 60 | #define IEEE80211_FC0_SUBTYPE_ATIM 0x90 61 | #define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0 62 | #define IEEE80211_FC0_SUBTYPE_AUTH 0xb0 63 | #define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0 64 | /* for TYPE_CTL */ 65 | #define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0 66 | #define IEEE80211_FC0_SUBTYPE_RTS 0xb0 67 | #define IEEE80211_FC0_SUBTYPE_CTS 0xc0 68 | #define IEEE80211_FC0_SUBTYPE_ACK 0xd0 69 | #define IEEE80211_FC0_SUBTYPE_CF_END 0xe0 70 | #define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0 71 | /* for TYPE_DATA (bit combination) */ 72 | #define IEEE80211_FC0_SUBTYPE_DATA 0x00 73 | #define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10 74 | #define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20 75 | #define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30 76 | #define IEEE80211_FC0_SUBTYPE_NODATA 0x40 77 | #define IEEE80211_FC0_SUBTYPE_NODATA_CF_ACK 0x50 78 | #define IEEE80211_FC0_SUBTYPE_NODATA_CF_POLL 0x60 79 | #define IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL 0x70 80 | #define IEEE80211_FC0_SUBTYPE_QOS 0x80 81 | #define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 82 | 83 | #define IEEE80211_FC1_DIR_MASK 0x03 84 | #define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ 85 | #define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ 86 | #define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ 87 | #define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ 88 | 89 | #define IEEE80211_FC1_MORE_FRAG 0x04 90 | #define IEEE80211_FC1_RETRY 0x08 91 | #define IEEE80211_FC1_PWR_MGT 0x10 92 | #define IEEE80211_FC1_MORE_DATA 0x20 93 | #define IEEE80211_FC1_WEP 0x40 94 | #define IEEE80211_FC1_ORDER 0x80 95 | 96 | #define IEEE80211_SEQ_FRAG_MASK 0x000f 97 | #define IEEE80211_SEQ_FRAG_SHIFT 0 98 | #define IEEE80211_SEQ_SEQ_MASK 0xfff0 99 | #define IEEE80211_SEQ_SEQ_SHIFT 4 100 | 101 | #define IEEE80211_NWID_LEN 32 102 | 103 | #define IEEE80211_QOS_TXOP 0x00ff 104 | /* bit 8 is reserved */ 105 | #define IEEE80211_QOS_ACKPOLICY 0x60 106 | #define IEEE80211_QOS_ACKPOLICY_S 5 107 | #define IEEE80211_QOS_ESOP 0x10 108 | #define IEEE80211_QOS_ESOP_S 4 109 | #define IEEE80211_QOS_TID 0x0f 110 | 111 | #define IEEE80211_MGT_SUBTYPE_NAMES { \ 112 | "assoc-req", "assoc-resp", \ 113 | "reassoc-req", "reassoc-resp", \ 114 | "probe-req", "probe-resp", \ 115 | "reserved#6", "reserved#7", \ 116 | "beacon", "atim", \ 117 | "disassoc", "auth", \ 118 | "deauth", "reserved#13", \ 119 | "reserved#14", "reserved#15" \ 120 | } 121 | 122 | #define IEEE80211_CTL_SUBTYPE_NAMES { \ 123 | "reserved#0", "reserved#1", \ 124 | "reserved#2", "reserved#3", \ 125 | "reserved#3", "reserved#5", \ 126 | "reserved#6", "reserved#7", \ 127 | "reserved#8", "reserved#9", \ 128 | "ps-poll", "rts", \ 129 | "cts", "ack", \ 130 | "cf-end", "cf-end-ack" \ 131 | } 132 | 133 | #define IEEE80211_DATA_SUBTYPE_NAMES { \ 134 | "data", "data-cf-ack", \ 135 | "data-cf-poll", "data-cf-ack-poll", \ 136 | "null", "cf-ack", \ 137 | "cf-poll", "cf-ack-poll", \ 138 | "qos-data", "qos-data-cf-ack", \ 139 | "qos-data-cf-poll", "qos-data-cf-ack-poll", \ 140 | "qos", "reserved#13", \ 141 | "qos-cf-poll", "qos-cf-ack-poll" \ 142 | } 143 | 144 | #define IEEE80211_TYPE_NAMES { "mgt", "ctl", "data", "reserved#4" } 145 | 146 | #endif /* _NET80211_IEEE80211_H_ */ 147 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/ipnet.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * This code is derived from the Stanford/CMU enet packet filter, 6 | * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7 | * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 8 | * Berkeley Laboratory. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 3. All advertising materials mentioning features or use of this software 19 | * must display the following acknowledgement: 20 | * This product includes software developed by the University of 21 | * California, Berkeley and its contributors. 22 | * 4. Neither the name of the University nor the names of its contributors 23 | * may be used to endorse or promote products derived from this software 24 | * without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 | * SUCH DAMAGE. 37 | */ 38 | 39 | #define IPH_AF_INET 2 /* Matches Solaris's AF_INET */ 40 | #define IPH_AF_INET6 26 /* Matches Solaris's AF_INET6 */ 41 | 42 | #define IPNET_OUTBOUND 1 43 | #define IPNET_INBOUND 2 44 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/llc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1993, 1994, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that: (1) source code distributions 7 | * retain the above copyright notice and this paragraph in its entirety, (2) 8 | * distributions including binary code include the above copyright notice and 9 | * this paragraph in its entirety in the documentation or other materials 10 | * provided with the distribution, and (3) all advertising materials mentioning 11 | * features or use of this software display the following acknowledgement: 12 | * ``This product includes software developed by the University of California, 13 | * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 | * the University nor the names of its contributors may be used to endorse 15 | * or promote products derived from this software without specific prior 16 | * written permission. 17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 | * 21 | */ 22 | 23 | /* 24 | * 802.2 LLC SAP values. 25 | */ 26 | 27 | #ifndef LLCSAP_NULL 28 | #define LLCSAP_NULL 0x00 29 | #endif 30 | #ifndef LLCSAP_GLOBAL 31 | #define LLCSAP_GLOBAL 0xff 32 | #endif 33 | #ifndef LLCSAP_8021B 34 | #define LLCSAP_8021B_I 0x02 35 | #endif 36 | #ifndef LLCSAP_8021B 37 | #define LLCSAP_8021B_G 0x03 38 | #endif 39 | #ifndef LLCSAP_IP 40 | #define LLCSAP_IP 0x06 41 | #endif 42 | #ifndef LLCSAP_PROWAYNM 43 | #define LLCSAP_PROWAYNM 0x0e 44 | #endif 45 | #ifndef LLCSAP_8021D 46 | #define LLCSAP_8021D 0x42 47 | #endif 48 | #ifndef LLCSAP_RS511 49 | #define LLCSAP_RS511 0x4e 50 | #endif 51 | #ifndef LLCSAP_ISO8208 52 | #define LLCSAP_ISO8208 0x7e 53 | #endif 54 | #ifndef LLCSAP_PROWAY 55 | #define LLCSAP_PROWAY 0x8e 56 | #endif 57 | #ifndef LLCSAP_SNAP 58 | #define LLCSAP_SNAP 0xaa 59 | #endif 60 | #ifndef LLCSAP_IPX 61 | #define LLCSAP_IPX 0xe0 62 | #endif 63 | #ifndef LLCSAP_NETBEUI 64 | #define LLCSAP_NETBEUI 0xf0 65 | #endif 66 | #ifndef LLCSAP_ISONS 67 | #define LLCSAP_ISONS 0xfe 68 | #endif 69 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/namedb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1994, 1996 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by the Computer Systems 16 | * Engineering Group at Lawrence Berkeley Laboratory. 17 | * 4. Neither the name of the University nor of the Laboratory may be used 18 | * to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | * 33 | */ 34 | 35 | #ifndef lib_pcap_namedb_h 36 | #define lib_pcap_namedb_h 37 | 38 | #include "sf-redefines.h" 39 | 40 | #ifdef __cplusplus 41 | extern "C" 42 | { 43 | #endif 44 | 45 | /* 46 | * As returned by the pcap_next_etherent() 47 | * XXX this stuff doesn't belong in this interface, but this 48 | * library already must do name to address translation, so 49 | * on systems that don't have support for /etc/ethers, we 50 | * export these hooks since they'll 51 | */ 52 | struct pcap_etherent 53 | { 54 | u_char addr[6]; 55 | char name[122]; 56 | }; 57 | #ifndef PCAP_ETHERS_FILE 58 | #define PCAP_ETHERS_FILE "/etc/ethers" 59 | #endif 60 | struct pcap_etherent *pcap_next_etherent(FILE *); 61 | u_char *pcap_ether_hostton(const char *); 62 | u_char *pcap_ether_aton(const char *); 63 | 64 | bpf_u_int32 **pcap_nametoaddr(const char *); 65 | #ifdef INET6 66 | struct addrinfo *pcap_nametoaddrinfo(const char *); 67 | #endif 68 | bpf_u_int32 pcap_nametonetaddr(const char *); 69 | 70 | int pcap_nametoport(const char *, int *, int *); 71 | int pcap_nametoportrange(const char *, int *, int *, int *); 72 | int pcap_nametoproto(const char *); 73 | int pcap_nametoeproto(const char *); 74 | int pcap_nametollc(const char *); 75 | /* 76 | * If a protocol is unknown, PROTO_UNDEF is returned. 77 | * Also, pcap_nametoport() returns the protocol along with the port number. 78 | * If there are ambiguous entried in /etc/services (i.e. domain 79 | * can be either tcp or udp) PROTO_UNDEF is returned. 80 | */ 81 | #define PROTO_UNDEF -1 82 | 83 | /* XXX move these to pcap-int.h? */ 84 | int __pcap_atodn(const char *, bpf_u_int32 *); 85 | int __pcap_atoin(const char *, bpf_u_int32 *); 86 | u_short __pcap_nametodnaddr(const char *); 87 | 88 | #ifdef __cplusplus 89 | } 90 | #endif 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/nlpid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1996 3 | * Juniper Networks, Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that: (1) source code distributions 7 | * retain the above copyright notice and this paragraph in its entirety, (2) 8 | * distributions including binary code include the above copyright notice and 9 | * this paragraph in its entirety in the documentation or other materials 10 | * provided with the distribution. The name of Juniper Networks may not 11 | * be used to endorse or promote products derived from this software 12 | * without specific prior written permission. 13 | * 14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 15 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 17 | * 18 | */ 19 | 20 | /* Types missing from some systems */ 21 | 22 | /* 23 | * Network layer prototocol identifiers 24 | */ 25 | #ifndef ISO8473_CLNP 26 | #define ISO8473_CLNP 0x81 27 | #endif 28 | #ifndef ISO9542_ESIS 29 | #define ISO9542_ESIS 0x82 30 | #endif 31 | #ifndef ISO9542X25_ESIS 32 | #define ISO9542X25_ESIS 0x8a 33 | #endif 34 | #ifndef ISO10589_ISIS 35 | #define ISO10589_ISIS 0x83 36 | #endif 37 | /* 38 | * this does not really belong in the nlpid.h file 39 | * however we need it for generating nice 40 | * IS-IS related BPF filters 41 | */ 42 | #define ISIS_L1_LAN_IIH 15 43 | #define ISIS_L2_LAN_IIH 16 44 | #define ISIS_PTP_IIH 17 45 | #define ISIS_L1_LSP 18 46 | #define ISIS_L2_LSP 20 47 | #define ISIS_L1_CSNP 24 48 | #define ISIS_L2_CSNP 25 49 | #define ISIS_L1_PSNP 26 50 | #define ISIS_L2_PSNP 27 51 | 52 | #ifndef ISO8878A_CONS 53 | #define ISO8878A_CONS 0x84 54 | #endif 55 | #ifndef ISO10747_IDRP 56 | #define ISO10747_IDRP 0x85 57 | #endif 58 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/ppp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Point to Point Protocol (PPP) RFC1331 3 | * 4 | * Copyright 1989 by Carnegie Mellon. 5 | * 6 | * Permission to use, copy, modify, and distribute this program for any 7 | * purpose and without fee is hereby granted, provided that this copyright 8 | * and permission notice appear on all copies and supporting documentation, 9 | * the name of Carnegie Mellon not be used in advertising or publicity 10 | * pertaining to distribution of the program without specific prior 11 | * permission, and notice be given in supporting documentation that copying 12 | * and distribution is by permission of Carnegie Mellon and Stanford 13 | * University. Carnegie Mellon makes no representations about the 14 | * suitability of this software for any purpose. It is provided "as is" 15 | * without express or implied warranty. 16 | */ 17 | #define PPP_ADDRESS 0xff /* The address byte value */ 18 | #define PPP_CONTROL 0x03 /* The control byte value */ 19 | 20 | #define PPP_PPPD_IN 0x00 /* non-standard for DLT_PPP_PPPD */ 21 | #define PPP_PPPD_OUT 0x01 /* non-standard for DLT_PPP_PPPD */ 22 | 23 | /* Protocol numbers */ 24 | #define PPP_IP 0x0021 /* Raw IP */ 25 | #define PPP_OSI 0x0023 /* OSI Network Layer */ 26 | #define PPP_NS 0x0025 /* Xerox NS IDP */ 27 | #define PPP_DECNET 0x0027 /* DECnet Phase IV */ 28 | #define PPP_APPLE 0x0029 /* Appletalk */ 29 | #define PPP_IPX 0x002b /* Novell IPX */ 30 | #define PPP_VJC 0x002d /* Van Jacobson Compressed TCP/IP */ 31 | #define PPP_VJNC 0x002f /* Van Jacobson Uncompressed TCP/IP */ 32 | #define PPP_BRPDU 0x0031 /* Bridging PDU */ 33 | #define PPP_STII 0x0033 /* Stream Protocol (ST-II) */ 34 | #define PPP_VINES 0x0035 /* Banyan Vines */ 35 | #define PPP_IPV6 0x0057 /* Internet Protocol version 6 */ 36 | 37 | #define PPP_HELLO 0x0201 /* 802.1d Hello Packets */ 38 | #define PPP_LUXCOM 0x0231 /* Luxcom */ 39 | #define PPP_SNS 0x0233 /* Sigma Network Systems */ 40 | #define PPP_MPLS_UCAST 0x0281 /* rfc 3032 */ 41 | #define PPP_MPLS_MCAST 0x0283 /* rfc 3022 */ 42 | 43 | #define PPP_IPCP 0x8021 /* IP Control Protocol */ 44 | #define PPP_OSICP 0x8023 /* OSI Network Layer Control Protocol */ 45 | #define PPP_NSCP 0x8025 /* Xerox NS IDP Control Protocol */ 46 | #define PPP_DECNETCP 0x8027 /* DECnet Control Protocol */ 47 | #define PPP_APPLECP 0x8029 /* Appletalk Control Protocol */ 48 | #define PPP_IPXCP 0x802b /* Novell IPX Control Protocol */ 49 | #define PPP_STIICP 0x8033 /* Strean Protocol Control Protocol */ 50 | #define PPP_VINESCP 0x8035 /* Banyan Vines Control Protocol */ 51 | #define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ 52 | #define PPP_MPLSCP 0x8281 /* rfc 3022 */ 53 | 54 | #define PPP_LCP 0xc021 /* Link Control Protocol */ 55 | #define PPP_PAP 0xc023 /* Password Authentication Protocol */ 56 | #define PPP_LQM 0xc025 /* Link Quality Monitoring */ 57 | #define PPP_CHAP 0xc223 /* Challenge Handshake Authentication Protocol */ 58 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/runlex.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # runlex.sh 5 | # Script to run Lex/Flex. 6 | # First argument is the (quoted) name of the command; if it's null, that 7 | # means that neither Flex nor Lex was found, so we report an error and 8 | # quit. 9 | # 10 | # 11 | 12 | # 13 | # Get the name of the command to run, and then shift to get the arguments. 14 | # 15 | if [ $# -eq 0 ] 16 | then 17 | echo "Usage: runlex [ arguments ]" 1>&2 18 | exit 1 19 | fi 20 | LEX="$1" 21 | shift 22 | 23 | # 24 | # Check whether we have Lex or Flex. 25 | # 26 | if [ -z "${LEX}" ] 27 | then 28 | echo "Neither lex nor flex was found" 1>&2 29 | exit 1 30 | fi 31 | 32 | # 33 | # Process the flags. We don't use getopt because we don't want to 34 | # embed complete knowledge of what options are supported by Lex/Flex. 35 | # 36 | flags="" 37 | outfile=lex.yy.c 38 | while [ $# -ne 0 ] 39 | do 40 | case "$1" in 41 | 42 | -o*) 43 | # 44 | # Set the output file name. 45 | # 46 | outfile=`echo "$1" | sed 's/-o\(.*\)/\1/'` 47 | ;; 48 | 49 | -*) 50 | # 51 | # Add this to the list of flags. 52 | # 53 | flags="$flags $1" 54 | ;; 55 | 56 | --|*) 57 | # 58 | # End of flags. 59 | # 60 | break 61 | ;; 62 | esac 63 | shift 64 | done 65 | 66 | # 67 | # Is it Lex, or is it Flex? 68 | # 69 | if [ "${LEX}" = flex ] 70 | then 71 | # 72 | # It's Flex. 73 | # 74 | have_flex=yes 75 | 76 | # 77 | # Does it support the --noFUNCTION options? If so, we pass 78 | # --nounput, as at least some versions that support those 79 | # options don't support disabling yyunput by defining 80 | # YY_NO_UNPUT. 81 | # 82 | if flex --help | egrep noFUNCTION >/dev/null 83 | then 84 | flags="$flags --nounput" 85 | 86 | # 87 | # Does it support -R, for generating reentrant scanners? 88 | # If so, we're not currently using that feature, but 89 | # it'll generate some unused functions anyway - and there 90 | # won't be any header file declaring them, so there'll be 91 | # defined-but-not-declared warnings. Therefore, we use 92 | # --noFUNCTION options to suppress generating those 93 | # functions. 94 | # 95 | if flex --help | egrep reentrant >/dev/null 96 | then 97 | flags="$flags --noyyget_lineno --noyyget_in --noyyget_out --noyyget_leng --noyyget_text --noyyset_lineno --noyyset_in --noyyset_out" 98 | fi 99 | fi 100 | else 101 | # 102 | # It's Lex. 103 | # 104 | have_flex=no 105 | fi 106 | 107 | # 108 | # OK, run it. 109 | # If it's lex, it doesn't support -o, so we just write to 110 | # lex.yy.c and, if it succeeds, rename it to the right name, 111 | # otherwise we remove lex.yy.c. 112 | # If it's flex, it supports -o, so we use that - flex with -P doesn't 113 | # write to lex.yy.c, it writes to a lex.{prefix from -P}.c. 114 | # 115 | if [ $have_flex = yes ] 116 | then 117 | ${LEX} $flags -o"$outfile" "$@" 118 | 119 | # 120 | # Did it succeed? 121 | # 122 | status=$? 123 | if [ $status -ne 0 ] 124 | then 125 | # 126 | # No. Exit with the failing exit status. 127 | # 128 | exit $status 129 | fi 130 | 131 | # 132 | # Flex has the annoying habit of stripping all but the last 133 | # component of the "-o" flag argument and using that as the 134 | # place to put the output. This gets in the way of building 135 | # in a directory different from the source directory. Try 136 | # to work around this. 137 | # 138 | # Is the outfile where we think it is? 139 | # 140 | outfile_base=`basename "$outfile"` 141 | if [ "$outfile_base" != "$outfile" -a \( ! -r "$outfile" \) -a -r "$outfile_base" ] 142 | then 143 | # 144 | # No, it's not, but it is in the current directory. Put it 145 | # where it's supposed to be. 146 | # 147 | mv "$outfile_base" "$outfile" 148 | 149 | # 150 | # Did that succeed? 151 | # 152 | status=$? 153 | if [ $status -ne 0 ] 154 | then 155 | # 156 | # No. Exit with the failing exit status. 157 | # 158 | exit $status 159 | fi 160 | fi 161 | else 162 | ${LEX} $flags "$@" 163 | 164 | # 165 | # Did it succeed? 166 | # 167 | status=$? 168 | if [ $status -ne 0 ] 169 | then 170 | # 171 | # No. Get rid of any lex.yy.c file we generated, and 172 | # exit with the failing exit status. 173 | # 174 | rm -f lex.yy.c 175 | exit $status 176 | fi 177 | 178 | # 179 | # OK, rename lex.yy.c to the right output file. 180 | # 181 | mv lex.yy.c "$outfile" 182 | 183 | # 184 | # Did that succeed? 185 | # 186 | status=$? 187 | if [ $status -ne 0 ] 188 | then 189 | # 190 | # No. Get rid of any lex.yy.c file we generated, and 191 | # exit with the failing exit status. 192 | # 193 | rm -f lex.yy.c 194 | exit $status 195 | fi 196 | fi 197 | 198 | # 199 | # OK, now let's generate a header file declaring the relevant functions 200 | # defined by the .c file; if the .c file is .../foo.c, the header file 201 | # will be .../foo.h. 202 | # 203 | # This works around some other Flex suckage, wherein it doesn't declare 204 | # the lex routine before defining it, causing compiler warnings. 205 | # XXX - newer versions of Flex support --header-file=, to generate the 206 | # appropriate header file. With those versions, we should use that option. 207 | # 208 | 209 | # 210 | # Get the name of the prefix; scan the source files for a %option prefix 211 | # line. We use the last one. 212 | # 213 | prefix=`sed -n 's/%option[ ][ ]*prefix="\(.*\)".*/\1/p' "$@" | tail -1` 214 | if [ ! -z "$prefix" ] 215 | then 216 | prefixline="#define yylex ${prefix}lex" 217 | fi 218 | 219 | # 220 | # Construct the name of the header file. 221 | # 222 | header_file=`dirname "$outfile"`/`basename "$outfile" .c`.h 223 | 224 | # 225 | # Spew out the declaration. 226 | # 227 | cat <$header_file 228 | /* This is generated by runlex.sh. Do not edit it. */ 229 | $prefixline 230 | #ifndef YY_DECL 231 | #define YY_DECL int yylex(void) 232 | #endif 233 | YY_DECL; 234 | EOF 235 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/scanner.l: -------------------------------------------------------------------------------- 1 | %{ 2 | /* 3 | * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 4 | * The Regents of the University of California. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that: (1) source code distributions 8 | * retain the above copyright notice and this paragraph in its entirety, (2) 9 | * distributions including binary code include the above copyright notice and 10 | * this paragraph in its entirety in the documentation or other materials 11 | * provided with the distribution, and (3) all advertising materials mentioning 12 | * features or use of this software display the following acknowledgement: 13 | * ``This product includes software developed by the University of California, 14 | * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 15 | * the University nor the names of its contributors may be used to endorse 16 | * or promote products derived from this software without specific prior 17 | * written permission. 18 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 21 | */ 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include "config.h" 25 | #endif 26 | 27 | #ifdef WIN32 28 | #include "win32-stdinc.h" 29 | #else /* WIN32 */ 30 | #if HAVE_INTTYPES_H 31 | #include 32 | #elif HAVE_STDINT_H 33 | #include 34 | #endif 35 | #ifdef HAVE_SYS_BITYPES_H 36 | #include 37 | #endif 38 | #include 39 | #endif /* WIN32 */ 40 | 41 | #include 42 | #include 43 | 44 | #include "sfbpf-int.h" 45 | 46 | #include "gencode.h" 47 | #ifdef INET6 48 | #ifdef WIN32 49 | #include "win32-stdinc.h" 50 | 51 | #ifdef __MINGW32__ 52 | #include "IP6_misc.h" 53 | #endif 54 | #else /* WIN32 */ 55 | #include /* for "struct sockaddr" in "struct addrinfo" */ 56 | #include /* for "struct addrinfo" */ 57 | #endif /* WIN32 */ 58 | 59 | /* Workaround for AIX 4.3 */ 60 | #if !defined(AI_NUMERICHOST) 61 | #define AI_NUMERICHOST 0x04 62 | #endif 63 | #endif /*INET6*/ 64 | #include "namedb.h" 65 | #include "tokdefs.h" 66 | 67 | static int stoi(char *); 68 | static inline int xdtoi(int); 69 | 70 | #ifdef FLEX_SCANNER 71 | #define YY_NO_UNPUT 72 | static YY_BUFFER_STATE in_buffer; 73 | #else 74 | static const char *in_buffer; 75 | 76 | #undef getc 77 | #define getc(fp) (*in_buffer == 0 ? EOF : *in_buffer++) 78 | #endif 79 | 80 | #define yylval pcap_lval 81 | extern YYSTYPE yylval; 82 | 83 | %} 84 | 85 | N ([0-9]+|(0X|0x)[0-9A-Fa-f]+) 86 | B ([0-9A-Fa-f][0-9A-Fa-f]?) 87 | B2 ([0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]) 88 | W ([0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?[0-9A-Fa-f]?) 89 | 90 | %a 18400 91 | %o 21500 92 | %e 7600 93 | %k 4550 94 | %p 27600 95 | %n 2000 96 | 97 | V680 {W}:{W}:{W}:{W}:{W}:{W}:{W}:{W} 98 | 99 | V670 ::{W}:{W}:{W}:{W}:{W}:{W}:{W} 100 | V671 {W}::{W}:{W}:{W}:{W}:{W}:{W} 101 | V672 {W}:{W}::{W}:{W}:{W}:{W}:{W} 102 | V673 {W}:{W}:{W}::{W}:{W}:{W}:{W} 103 | V674 {W}:{W}:{W}:{W}::{W}:{W}:{W} 104 | V675 {W}:{W}:{W}:{W}:{W}::{W}:{W} 105 | V676 {W}:{W}:{W}:{W}:{W}:{W}::{W} 106 | V677 {W}:{W}:{W}:{W}:{W}:{W}:{W}:: 107 | 108 | V660 ::{W}:{W}:{W}:{W}:{W}:{W} 109 | V661 {W}::{W}:{W}:{W}:{W}:{W} 110 | V662 {W}:{W}::{W}:{W}:{W}:{W} 111 | V663 {W}:{W}:{W}::{W}:{W}:{W} 112 | V664 {W}:{W}:{W}:{W}::{W}:{W} 113 | V665 {W}:{W}:{W}:{W}:{W}::{W} 114 | V666 {W}:{W}:{W}:{W}:{W}:{W}:: 115 | 116 | V650 ::{W}:{W}:{W}:{W}:{W} 117 | V651 {W}::{W}:{W}:{W}:{W} 118 | V652 {W}:{W}::{W}:{W}:{W} 119 | V653 {W}:{W}:{W}::{W}:{W} 120 | V654 {W}:{W}:{W}:{W}::{W} 121 | V655 {W}:{W}:{W}:{W}:{W}:: 122 | 123 | V640 ::{W}:{W}:{W}:{W} 124 | V641 {W}::{W}:{W}:{W} 125 | V642 {W}:{W}::{W}:{W} 126 | V643 {W}:{W}:{W}::{W} 127 | V644 {W}:{W}:{W}:{W}:: 128 | 129 | V630 ::{W}:{W}:{W} 130 | V631 {W}::{W}:{W} 131 | V632 {W}:{W}::{W} 132 | V633 {W}:{W}:{W}:: 133 | 134 | V620 ::{W}:{W} 135 | V621 {W}::{W} 136 | V622 {W}:{W}:: 137 | 138 | V610 ::{W} 139 | V611 {W}:: 140 | 141 | V600 :: 142 | 143 | V6604 {W}:{W}:{W}:{W}:{W}:{W}:{N}\.{N}\.{N}\.{N} 144 | 145 | V6504 ::{W}:{W}:{W}:{W}:{W}:{N}\.{N}\.{N}\.{N} 146 | V6514 {W}::{W}:{W}:{W}:{W}:{N}\.{N}\.{N}\.{N} 147 | V6524 {W}:{W}::{W}:{W}:{W}:{N}\.{N}\.{N}\.{N} 148 | V6534 {W}:{W}:{W}::{W}:{W}:{N}\.{N}\.{N}\.{N} 149 | V6544 {W}:{W}:{W}:{W}::{W}:{N}\.{N}\.{N}\.{N} 150 | V6554 {W}:{W}:{W}:{W}:{W}::{N}\.{N}\.{N}\.{N} 151 | 152 | V6404 ::{W}:{W}:{W}:{W}:{N}\.{N}\.{N}\.{N} 153 | V6414 {W}::{W}:{W}:{W}:{N}\.{N}\.{N}\.{N} 154 | V6424 {W}:{W}::{W}:{W}:{N}\.{N}\.{N}\.{N} 155 | V6434 {W}:{W}:{W}::{W}:{N}\.{N}\.{N}\.{N} 156 | V6444 {W}:{W}:{W}:{W}::{N}\.{N}\.{N}\.{N} 157 | 158 | V6304 ::{W}:{W}:{W}:{N}\.{N}\.{N}\.{N} 159 | V6314 {W}::{W}:{W}:{N}\.{N}\.{N}\.{N} 160 | V6324 {W}:{W}::{W}:{N}\.{N}\.{N}\.{N} 161 | V6334 {W}:{W}:{W}::{N}\.{N}\.{N}\.{N} 162 | 163 | V6204 ::{W}:{W}:{N}\.{N}\.{N}\.{N} 164 | V6214 {W}::{W}:{N}\.{N}\.{N}\.{N} 165 | V6224 {W}:{W}::{N}\.{N}\.{N}\.{N} 166 | 167 | V6104 ::{W}:{N}\.{N}\.{N}\.{N} 168 | V6114 {W}::{N}\.{N}\.{N}\.{N} 169 | 170 | V6004 ::{N}\.{N}\.{N}\.{N} 171 | 172 | 173 | V6 ({V680}|{V670}|{V671}|{V672}|{V673}|{V674}|{V675}|{V676}|{V677}|{V660}|{V661}|{V662}|{V663}|{V664}|{V665}|{V666}|{V650}|{V651}|{V652}|{V653}|{V654}|{V655}|{V640}|{V641}|{V642}|{V643}|{V644}|{V630}|{V631}|{V632}|{V633}|{V620}|{V621}|{V622}|{V610}|{V611}|{V600}|{V6604}|{V6504}|{V6514}|{V6524}|{V6534}|{V6544}|{V6554}|{V6404}|{V6414}|{V6424}|{V6434}|{V6444}|{V6304}|{V6314}|{V6324}|{V6334}|{V6204}|{V6214}|{V6224}|{V6104}|{V6114}|{V6004}) 174 | 175 | MAC ({B}:{B}:{B}:{B}:{B}:{B}|{B}\-{B}\-{B}\-{B}\-{B}\-{B}|{B}\.{B}\.{B}\.{B}\.{B}\.{B}|{B2}\.{B2}\.{B2}|{B2}{3}) 176 | 177 | 178 | 179 | %% 180 | dst return DST; 181 | src return SRC; 182 | 183 | link|ether|ppp|slip return LINK; 184 | fddi|tr|wlan return LINK; 185 | arp return ARP; 186 | rarp return RARP; 187 | ip return IP; 188 | sctp return SCTP; 189 | tcp return TCP; 190 | udp return UDP; 191 | icmp return ICMP; 192 | igmp return IGMP; 193 | igrp return IGRP; 194 | pim return PIM; 195 | vrrp return VRRP; 196 | radio return RADIO; 197 | 198 | ip6 { 199 | #ifdef INET6 200 | return IPV6; 201 | #else 202 | bpf_error("%s not supported", yytext); 203 | #endif 204 | } 205 | icmp6 { 206 | #ifdef INET6 207 | return ICMPV6; 208 | #else 209 | bpf_error("%s not supported", yytext); 210 | #endif 211 | } 212 | ah return AH; 213 | esp return ESP; 214 | 215 | atalk return ATALK; 216 | aarp return AARP; 217 | decnet return DECNET; 218 | lat return LAT; 219 | sca return SCA; 220 | moprc return MOPRC; 221 | mopdl return MOPDL; 222 | 223 | iso return ISO; 224 | esis return ESIS; 225 | es-is return ESIS; 226 | isis return ISIS; 227 | is-is return ISIS; 228 | l1 return L1; 229 | l2 return L2; 230 | iih return IIH; 231 | lsp return LSP; 232 | snp return SNP; 233 | csnp return CSNP; 234 | psnp return PSNP; 235 | 236 | clnp return CLNP; 237 | 238 | stp return STP; 239 | 240 | ipx return IPX; 241 | 242 | netbeui return NETBEUI; 243 | 244 | host return HOST; 245 | net return NET; 246 | mask return NETMASK; 247 | port return PORT; 248 | portrange return PORTRANGE; 249 | proto return PROTO; 250 | protochain { 251 | #ifdef NO_PROTOCHAIN 252 | bpf_error("%s not supported", yytext); 253 | #else 254 | return PROTOCHAIN; 255 | #endif 256 | } 257 | 258 | gateway return GATEWAY; 259 | 260 | type return TYPE; 261 | subtype return SUBTYPE; 262 | direction|dir return DIR; 263 | address1|addr1 return ADDR1; 264 | address2|addr2 return ADDR2; 265 | address3|addr3 return ADDR3; 266 | address4|addr4 return ADDR4; 267 | 268 | less return LESS; 269 | greater return GREATER; 270 | byte return CBYTE; 271 | broadcast return TK_BROADCAST; 272 | multicast return TK_MULTICAST; 273 | 274 | and|"&&" return AND; 275 | or|"||" return OR; 276 | not return '!'; 277 | 278 | len|length return LEN; 279 | inbound return INBOUND; 280 | outbound return OUTBOUND; 281 | 282 | vlan return VLAN; 283 | mpls return MPLS; 284 | pppoed return PPPOED; 285 | pppoes return PPPOES; 286 | 287 | lane return LANE; 288 | llc return LLC; 289 | metac return METAC; 290 | bcc return BCC; 291 | oam return OAM; 292 | oamf4 return OAMF4; 293 | oamf4ec return OAMF4EC; 294 | oamf4sc return OAMF4SC; 295 | sc return SC; 296 | ilmic return ILMIC; 297 | vpi return VPI; 298 | vci return VCI; 299 | connectmsg return CONNECTMSG; 300 | metaconnect return METACONNECT; 301 | 302 | on|ifname return PF_IFNAME; 303 | rset|ruleset return PF_RSET; 304 | rnr|rulenum return PF_RNR; 305 | srnr|subrulenum return PF_SRNR; 306 | reason return PF_REASON; 307 | action return PF_ACTION; 308 | 309 | fisu return FISU; 310 | lssu return LSSU; 311 | lsu return LSSU; 312 | msu return MSU; 313 | sio return SIO; 314 | opc return OPC; 315 | dpc return DPC; 316 | sls return SLS; 317 | 318 | [ \r\n\t] ; 319 | [+\-*/:\[\]!<>()&|=] return yytext[0]; 320 | ">=" return GEQ; 321 | "<=" return LEQ; 322 | "!=" return NEQ; 323 | "==" return '='; 324 | "<<" return LSH; 325 | ">>" return RSH; 326 | ${B} { yylval.e = pcap_ether_aton(((char *)yytext)+1); 327 | return AID; } 328 | {MAC} { yylval.e = pcap_ether_aton((char *)yytext); 329 | return EID; } 330 | {N} { yylval.i = stoi((char *)yytext); return NUM; } 331 | ({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) { 332 | yylval.s = sdup((char *)yytext); return HID; } 333 | {V6} { 334 | #ifdef INET6 335 | struct addrinfo hints, *res; 336 | memset(&hints, 0, sizeof(hints)); 337 | hints.ai_family = AF_INET6; 338 | hints.ai_flags = AI_NUMERICHOST; 339 | if (getaddrinfo(yytext, NULL, &hints, &res)) 340 | bpf_error("bogus IPv6 address %s", yytext); 341 | else { 342 | freeaddrinfo(res); 343 | yylval.s = sdup((char *)yytext); return HID6; 344 | } 345 | #else 346 | bpf_error("IPv6 address %s not supported", yytext); 347 | #endif /*INET6*/ 348 | } 349 | {B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); } 350 | icmptype { yylval.i = 0; return NUM; } 351 | icmpcode { yylval.i = 1; return NUM; } 352 | icmp-echoreply { yylval.i = 0; return NUM; } 353 | icmp-unreach { yylval.i = 3; return NUM; } 354 | icmp-sourcequench { yylval.i = 4; return NUM; } 355 | icmp-redirect { yylval.i = 5; return NUM; } 356 | icmp-echo { yylval.i = 8; return NUM; } 357 | icmp-routeradvert { yylval.i = 9; return NUM; } 358 | icmp-routersolicit { yylval.i = 10; return NUM; } 359 | icmp-timxceed { yylval.i = 11; return NUM; } 360 | icmp-paramprob { yylval.i = 12; return NUM; } 361 | icmp-tstamp { yylval.i = 13; return NUM; } 362 | icmp-tstampreply { yylval.i = 14; return NUM; } 363 | icmp-ireq { yylval.i = 15; return NUM; } 364 | icmp-ireqreply { yylval.i = 16; return NUM; } 365 | icmp-maskreq { yylval.i = 17; return NUM; } 366 | icmp-maskreply { yylval.i = 18; return NUM; } 367 | tcpflags { yylval.i = 13; return NUM; } 368 | tcp-fin { yylval.i = 0x01; return NUM; } 369 | tcp-syn { yylval.i = 0x02; return NUM; } 370 | tcp-rst { yylval.i = 0x04; return NUM; } 371 | tcp-push { yylval.i = 0x08; return NUM; } 372 | tcp-ack { yylval.i = 0x10; return NUM; } 373 | tcp-urg { yylval.i = 0x20; return NUM; } 374 | [A-Za-z0-9]([-_.A-Za-z0-9]*[.A-Za-z0-9])? { 375 | yylval.s = sdup((char *)yytext); return ID; } 376 | "\\"[^ !()\n\t]+ { yylval.s = sdup((char *)yytext + 1); return ID; } 377 | [^ \[\]\t\n\-_.A-Za-z0-9!<>()&|=]+ { 378 | bpf_error("illegal token: %s", yytext); } 379 | . { bpf_error("illegal char '%c'", *yytext); } 380 | %% 381 | void 382 | lex_init(buf) 383 | const char *buf; 384 | { 385 | #ifdef FLEX_SCANNER 386 | in_buffer = yy_scan_string(buf); 387 | #else 388 | in_buffer = buf; 389 | #endif 390 | } 391 | 392 | /* 393 | * Do any cleanup necessary after parsing. 394 | */ 395 | void 396 | lex_cleanup() 397 | { 398 | #ifdef FLEX_SCANNER 399 | if (in_buffer != NULL) 400 | yy_delete_buffer(in_buffer); 401 | in_buffer = NULL; 402 | #endif 403 | } 404 | 405 | /* 406 | * Also define a yywrap. Note that if we're using flex, it will 407 | * define a macro to map this identifier to pcap_wrap. 408 | */ 409 | int 410 | yywrap() 411 | { 412 | return 1; 413 | } 414 | 415 | /* Hex digit to integer. */ 416 | static inline int 417 | xdtoi(c) 418 | register int c; 419 | { 420 | if (isdigit(c)) 421 | return c - '0'; 422 | else if (islower(c)) 423 | return c - 'a' + 10; 424 | else 425 | return c - 'A' + 10; 426 | } 427 | 428 | /* 429 | * Convert string to integer. Just like atoi(), but checks for 430 | * preceding 0x or 0 and uses hex or octal instead of decimal. 431 | */ 432 | static int 433 | stoi(s) 434 | char *s; 435 | { 436 | int base = 10; 437 | int n = 0; 438 | 439 | if (*s == '0') { 440 | if (s[1] == 'x' || s[1] == 'X') { 441 | s += 2; 442 | base = 16; 443 | } 444 | else { 445 | base = 8; 446 | s += 1; 447 | } 448 | } 449 | while (*s) 450 | n = n * base + xdtoi(*s++); 451 | 452 | return n; 453 | } 454 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/sf-redefines.h: -------------------------------------------------------------------------------- 1 | #ifndef _SF_REDEFINES 2 | #define _SF_REDEFINES 3 | 4 | #define gen_loadi sf_gen_loadi 5 | #define gen_load sf_gen_load 6 | #define gen_loadlen sf_gen_loadlen 7 | #define gen_neg sf_gen_neg 8 | #define gen_arth sf_gen_arth 9 | 10 | #define gen_and sf_gen_and 11 | #define gen_or sf_gen_or 12 | #define gen_not sf_gen_not 13 | 14 | #define gen_scode sf_gen_scode 15 | #define gen_ecode sf_gen_ecode 16 | #define gen_acode sf_gen_acode 17 | #define gen_mcode sf_gen_mcode 18 | #ifdef INET6 19 | #define gen_mcode6 sf_gen_mcode6 20 | #endif 21 | #define gen_ncode sf_gen_ncode 22 | #define gen_proto_abbrev sf_gen_proto_abbrev 23 | #define gen_relation sf_gen_relation 24 | #define gen_less sf_gen_less 25 | #define gen_greater sf_gen_greater 26 | #define gen_byteop sf_gen_byteop 27 | #define gen_broadcast sf_gen_broadcast 28 | #define gen_multicast sf_gen_multicast 29 | #define gen_inbound sf_gen_inbound 30 | 31 | #define gen_vlan sf_gen_vlan 32 | #define gen_mpls sf_gen_mpls 33 | 34 | #define gen_pppoed sf_gen_pppoed 35 | #define gen_pppoes sf_gen_pppoes 36 | 37 | #define gen_atmfield_code sf_gen_atmfield_code 38 | #define gen_atmtype_abbrev sf_gen_atmtype_abbrev 39 | #define gen_atmmulti_abbrev sf_gen_atmmulti_abbrev 40 | 41 | #define gen_mtp2type_abbrev sf_gen_mtp2type_abbrev 42 | #define gen_mtp3field_code sf_gen_mtp3field_code 43 | 44 | #define gen_pf_ifname sf_gen_pf_ifname 45 | #define gen_pf_rnr sf_gen_pf_rnr 46 | #define gen_pf_srnr sf_gen_pf_srnr 47 | #define gen_pf_ruleset sf_gen_pf_ruleset 48 | #define gen_pf_reason sf_gen_pf_reason 49 | #define gen_pf_action sf_gen_pf_action 50 | #define gen_pf_dir sf_gen_pf_dir 51 | 52 | #define gen_p80211_type sf_gen_p80211_type 53 | #define gen_p80211_fcdir sf_gen_p80211_fcdir 54 | 55 | #define gen_portop sf_gen_portop 56 | #define gen_portop6 sf_gen_portop6 57 | #define gen_portrangeop sf_gen_portrangeop 58 | #define gen_portrangeop6 sf_gen_portrangeop6 59 | #define n_errors sf_n_errors 60 | 61 | #define bpf_optimize sf_bpf_optimize 62 | #define bpf_error sf_bpf_error 63 | 64 | #define finish_parse sf_finish_parse 65 | #define sdup sf_sdup 66 | 67 | #define icode_to_fcode sf_icode_to_fcode 68 | #define lex_init sf_lex_init 69 | #define lex_cleanup sf_lex_cleanup 70 | #define sappend sf_append 71 | 72 | #define pcap_parse sfbpf_parse 73 | 74 | #define pcap_lval sfbpf_lval 75 | 76 | #define bpf_int32 sfbpf_int32 77 | #define bpf_u_int32 sfbpf_u_int32 78 | #define bpf_insn sfbpf_insn 79 | #define bpf_program sfbpf_program 80 | 81 | #define bpf_filter sfbpf_filter 82 | #define bpf_validate sfbpf_validate 83 | 84 | #define BPF_ALIGNMENT SFBPF_ALIGNMENT 85 | #define BPF_WORDALIGN SFBPF_WORDALIGN 86 | 87 | #define BPF_MAXBUFSIZE SFBPF_MAXBUFSIZE 88 | #define BPF_MINBUFSIZE SFBPF_MINBUFSIZE 89 | 90 | #define BPF_CLASS SFBPF_CLASS 91 | #define BPF_LD SFBPF_LD 92 | #define BPF_LDX SFBPF_LDX 93 | #define BPF_ST SFBPF_ST 94 | #define BPF_STX SFBPF_STX 95 | #define BPF_ALU SFBPF_ALU 96 | #define BPF_JMP SFBPF_JMP 97 | #define BPF_RET SFBPF_RET 98 | #define BPF_MISC SFBPF_MISC 99 | 100 | #define BPF_SIZE SFBPF_SIZE 101 | #define BPF_W SFBPF_W 102 | #define BPF_H SFBPF_H 103 | #define BPF_B SFBPF_B 104 | 105 | #define BPF_MODE SFBPF_MODE 106 | #define BPF_IMM SFBPF_IMM 107 | #define BPF_ABS SFBPF_ABS 108 | #define BPF_IND SFBPF_IND 109 | #define BPF_MEM SFBPF_MEM 110 | #define BPF_LEN SFBPF_LEN 111 | #define BPF_MSH SFBPF_MSH 112 | 113 | #define BPF_OP SFBPF_OP 114 | #define BPF_ADD SFBPF_ADD 115 | #define BPF_SUB SFBPF_SUB 116 | #define BPF_MUL SFBPF_MUL 117 | #define BPF_DIV SFBPF_DIV 118 | #define BPF_OR SFBPF_OR 119 | #define BPF_AND SFBPF_AND 120 | #define BPF_LSH SFBPF_LSH 121 | #define BPF_RSH SFBPF_RSH 122 | #define BPF_NEG SFBPF_NEG 123 | #define BPF_JA SFBPF_JA 124 | #define BPF_JEQ SFBPF_JEQ 125 | #define BPF_JGT SFBPF_JGT 126 | #define BPF_JGE SFBPF_JGE 127 | #define BPF_JSET SFBPF_JSET 128 | 129 | #define BPF_SRC SFBPF_SRC 130 | #define BPF_K SFBPF_K 131 | #define BPF_X SFBPF_X 132 | 133 | #define BPF_RVAL SFBPF_RVAL 134 | #define BPF_A SFBPF_A 135 | 136 | #define BPF_MISCOP SFBPF_MISCOP 137 | #define BPF_TAX SFBPF_TAX 138 | #define BPF_TXA SFBPF_TXA 139 | 140 | #define BPF_STMT SFBPF_STMT 141 | #define BPF_JUMP SFBPF_JUMP 142 | 143 | #define BPF_MEMWORDS SFBPF_MEMWORDS 144 | 145 | #define PCAP_NETMASK_UNKNOWN SFBPF_NETMASK_UNKNOWN 146 | 147 | #define pcap_compile sfbpf_compile 148 | #define pcap_compile_unsafe sfbpf_compile_unsafe 149 | #define pcap_freecode sfbpf_freecode 150 | 151 | #endif 152 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/sf_bpf_printer.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved. 3 | ** Copyright (C) 2010-2013 Sourcefire, Inc. 4 | ** Author: Michael R. Altizer 5 | ** 6 | ** This program is free software; you can redistribute it and/or modify 7 | ** it under the terms of the GNU General Public License Version 2 as 8 | ** published by the Free Software Foundation. You may not use, modify or 9 | ** distribute this program under any other version of the GNU General 10 | ** Public License. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software 19 | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include "config.h" 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | #include "sfbpf-int.h" 30 | 31 | struct entry { 32 | uint32_t code; 33 | const char *name; 34 | }; 35 | 36 | static struct entry classes[] = { 37 | { BPF_LD , "LD "}, 38 | { BPF_LDX , "LDX "}, 39 | { BPF_ST , "ST "}, 40 | { BPF_STX , "STX "}, 41 | { BPF_ALU , "ALU "}, 42 | { BPF_JMP , "JMP "}, 43 | { BPF_RET , "RET "}, 44 | { BPF_MISC, "MISC"}, 45 | { 0, NULL } 46 | }; 47 | 48 | static struct entry ldx_sizes[] = { 49 | { BPF_W, "W"}, 50 | { BPF_H, "H"}, 51 | { BPF_B, "B"}, 52 | { 0, NULL } 53 | }; 54 | 55 | static struct entry ldx_modes[] = { 56 | { BPF_IMM, "IMM"}, 57 | { BPF_ABS, "ABS"}, 58 | { BPF_IND, "IND"}, 59 | { BPF_MEM, "MEM"}, 60 | { BPF_LEN, "LEN"}, 61 | { BPF_MSH, "MSH"}, 62 | { 0, NULL } 63 | }; 64 | 65 | static struct entry alu_ops[] = { 66 | { BPF_ADD, "ADD"}, 67 | { BPF_SUB, "SUB"}, 68 | { BPF_MUL, "MUL"}, 69 | { BPF_DIV, "DIV"}, 70 | { BPF_OR , "OR "}, 71 | { BPF_AND, "AND"}, 72 | { BPF_LSH, "LSH"}, 73 | { BPF_RSH, "RSH"}, 74 | { BPF_NEG, "NEG"}, 75 | { 0, NULL } 76 | }; 77 | 78 | static struct entry jmp_ops[] = { 79 | { BPF_JA , "JA "}, 80 | { BPF_JEQ , "JEQ "}, 81 | { BPF_JGT , "JGT "}, 82 | { BPF_JGE , "JGE "}, 83 | { BPF_JSET, "JSET"}, 84 | { 0, NULL } 85 | }; 86 | 87 | static struct entry srcs[] = { 88 | { BPF_K, "K"}, 89 | { BPF_X, "X"}, 90 | { 0, NULL } 91 | }; 92 | 93 | static struct entry rvals[] = { 94 | { BPF_K, "K"}, 95 | { BPF_X, "X"}, 96 | { BPF_A, "A"}, 97 | { 0, NULL } 98 | }; 99 | 100 | static struct entry misc_ops[] = { 101 | { BPF_TAX, "TAX"}, 102 | { BPF_TXA, "TXA"}, 103 | { 0, NULL } 104 | }; 105 | 106 | static const char *get_code_name(struct entry *table, uint32_t code) 107 | { 108 | int i; 109 | 110 | for (i = 0; table[i].name; i++) 111 | { 112 | if (code == table[i].code) 113 | return table[i].name; 114 | } 115 | return NULL; 116 | } 117 | 118 | static int get_size(uint32_t code) 119 | { 120 | code = BPF_SIZE(code); 121 | if (code == BPF_W) 122 | return 4; 123 | if (code == BPF_H) 124 | return 2; 125 | if (code == BPF_B) 126 | return 1; 127 | return 0; 128 | } 129 | 130 | static void print_ld(struct bpf_insn *inst) 131 | { 132 | printf("LD A <- "); 133 | switch (BPF_MODE(inst->code)) 134 | { 135 | case BPF_ABS: 136 | printf("P[%d:%d]", inst->k, get_size(inst->code)); 137 | break; 138 | case BPF_IND: 139 | printf("P[X+%d:%d]", inst->k, get_size(inst->code)); 140 | break; 141 | case BPF_LEN: 142 | printf("len"); 143 | break; 144 | case BPF_IMM: 145 | printf("%d", inst->k); 146 | break; 147 | case BPF_MEM: 148 | printf("M[%d]", inst->k); 149 | break; 150 | default: 151 | printf("???"); 152 | } 153 | printf("\n"); 154 | } 155 | 156 | static void print_ldx(struct bpf_insn *inst) 157 | { 158 | printf("LDX X <- "); 159 | switch (BPF_MODE(inst->code)) 160 | { 161 | case BPF_LEN: 162 | printf("len"); 163 | break; 164 | case BPF_IMM: 165 | printf("%d", inst->k); 166 | break; 167 | case BPF_MEM: 168 | printf("M[%d]", inst->k); 169 | break; 170 | case BPF_MSH: 171 | printf("4*(P[%d:1]&0xf)", inst->k); 172 | break; 173 | } 174 | printf("\n"); 175 | } 176 | 177 | static void print_alu(struct bpf_insn *inst) 178 | { 179 | const char *op; 180 | 181 | switch (BPF_OP(inst->code)) 182 | { 183 | case BPF_ADD: 184 | op = "+"; 185 | break; 186 | case BPF_SUB: 187 | op = "-"; 188 | break; 189 | case BPF_MUL: 190 | op = "*"; 191 | break; 192 | case BPF_DIV: 193 | op = "/"; 194 | break; 195 | case BPF_OR: 196 | op = "|"; 197 | break; 198 | case BPF_AND: 199 | op = "&"; 200 | break; 201 | case BPF_LSH: 202 | op = "<<"; 203 | break; 204 | case BPF_RSH: 205 | op = ">>"; 206 | break; 207 | case BPF_NEG: 208 | printf("ALU -A\n"); 209 | return; 210 | default: 211 | op = "???"; 212 | break; 213 | } 214 | printf("ALU A <- A %s \n", op); 215 | switch(BPF_SRC(inst->code)) 216 | { 217 | case BPF_K: 218 | printf("%d", inst->k); 219 | break; 220 | case BPF_X: 221 | printf("X"); 222 | break; 223 | default: 224 | printf("???"); 225 | } 226 | printf("\n"); 227 | } 228 | 229 | static void print_jmp(struct bpf_insn *inst, int line) 230 | { 231 | const char *op; 232 | 233 | switch(BPF_OP(inst->code)) 234 | { 235 | case BPF_JA: 236 | printf("JMP L%d\n", line + 1 + inst->k); 237 | return; 238 | case BPF_JEQ: 239 | op = "=="; 240 | break; 241 | case BPF_JGT: 242 | op = ">"; 243 | break; 244 | case BPF_JGE: 245 | op = ">="; 246 | break; 247 | case BPF_JSET: 248 | op = "&"; 249 | break; 250 | default: 251 | op = "???"; 252 | break; 253 | } 254 | printf("JMP (A %s ", op); 255 | switch(BPF_SRC(inst->code)) 256 | { 257 | case BPF_K: 258 | printf("%d", inst->k); 259 | break; 260 | case BPF_X: 261 | printf("X"); 262 | break; 263 | default: 264 | printf("???"); 265 | break; 266 | } 267 | printf(") ? L%d : L%d\n", line + 1 + inst->jt, line + 1 + inst->jf); 268 | } 269 | 270 | static void print_ret(struct bpf_insn *inst) 271 | { 272 | printf("RET accept "); 273 | switch (BPF_RVAL(inst->code)) 274 | { 275 | case BPF_K: 276 | printf("%d", inst->k); 277 | break; 278 | case BPF_X: 279 | printf("X"); 280 | break; 281 | case BPF_A: 282 | printf("A"); 283 | break; 284 | default: 285 | printf("???"); 286 | break; 287 | } 288 | printf(" bytes\n"); 289 | } 290 | 291 | static void print_misc(struct bpf_insn *inst) 292 | { 293 | printf("MISC "); 294 | switch (BPF_MISCOP(inst->code)) 295 | { 296 | case BPF_TAX: 297 | printf("X <- A"); 298 | break; 299 | case BPF_TXA: 300 | printf("A <- X"); 301 | break; 302 | default: 303 | printf("???"); 304 | break; 305 | } 306 | printf("\n"); 307 | } 308 | 309 | static void pretty_print_instruction(struct bpf_insn *inst, int line) 310 | { 311 | switch(BPF_CLASS(inst->code)) 312 | { 313 | case BPF_LD: 314 | print_ld(inst); 315 | break; 316 | case BPF_LDX: 317 | print_ldx(inst); 318 | break; 319 | case BPF_ST: 320 | printf("ST M[%d] <- A\n", inst->k); 321 | break; 322 | case BPF_STX: 323 | printf("STX M[%d] <- X\n", inst->k); 324 | break; 325 | case BPF_ALU: 326 | print_alu(inst); 327 | break; 328 | case BPF_JMP: 329 | print_jmp(inst, line); 330 | break; 331 | case BPF_RET: 332 | print_ret(inst); 333 | break; 334 | case BPF_MISC: 335 | print_misc(inst); 336 | break; 337 | } 338 | } 339 | 340 | static void print_instruction(struct bpf_insn *inst) 341 | { 342 | printf("%s ", get_code_name(classes, BPF_CLASS(inst->code))); 343 | switch(BPF_CLASS(inst->code)) 344 | { 345 | case BPF_LD: 346 | case BPF_LDX: 347 | printf("size=%s mode=%s\n", get_code_name(ldx_sizes, BPF_SIZE(inst->code)), get_code_name(ldx_modes, BPF_MODE(inst->code))); 348 | break; 349 | case BPF_ALU: 350 | printf("op=%s src=%s\n", get_code_name(alu_ops, BPF_OP(inst->code)), get_code_name(srcs, BPF_SRC(inst->code))); 351 | break; 352 | case BPF_JMP: 353 | printf("op=%s src=%s\n", get_code_name(jmp_ops, BPF_OP(inst->code)), get_code_name(srcs, BPF_SRC(inst->code))); 354 | break; 355 | case BPF_RET: 356 | printf("rval=%s\n", get_code_name(rvals, BPF_RVAL(inst->code))); 357 | break; 358 | case BPF_MISC: 359 | printf("op=%s\n", get_code_name(misc_ops, BPF_MISCOP(inst->code))); 360 | break; 361 | } 362 | printf(" jt=%u jf=%u k=%u\n", inst->jt, inst->jf, inst->k); 363 | } 364 | 365 | DAQ_SO_PUBLIC void sfbpf_print(struct bpf_program *fp, int verbose) 366 | { 367 | struct bpf_insn *bi; 368 | unsigned int i; 369 | 370 | printf("Printing BPF:\n"); 371 | for (i = 0; i < fp->bf_len; i++) 372 | { 373 | bi = fp->bf_insns + i; 374 | printf("%3d: ", i); 375 | if (verbose) 376 | print_instruction(bi); 377 | else 378 | pretty_print_instruction(bi, i); 379 | } 380 | } 381 | 382 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/sf_nametoaddr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Some portions Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved. 6 | * Some portions Copyright (C) 2010-2013 Sourcefire, Inc. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that: (1) source code distributions 10 | * retain the above copyright notice and this paragraph in its entirety, (2) 11 | * distributions including binary code include the above copyright notice and 12 | * this paragraph in its entirety in the documentation or other materials 13 | * provided with the distribution, and (3) all advertising materials mentioning 14 | * features or use of this software display the following acknowledgement: 15 | * ``This product includes software developed by the University of California, 16 | * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 17 | * the University nor the names of its contributors may be used to endorse 18 | * or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 23 | * 24 | * Name to id translation routines used by the scanner. 25 | * These functions are not time critical. 26 | */ 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | #ifdef DECNETLIB 33 | #include 34 | #include 35 | #endif 36 | 37 | #ifdef WIN32 38 | #include 39 | 40 | #else /* WIN32 */ 41 | 42 | #include 43 | #include /* concession to AIX */ 44 | #include 45 | #include 46 | 47 | #include 48 | #endif /* WIN32 */ 49 | 50 | #ifndef WIN32 51 | #ifdef HAVE_ETHER_HOSTTON 52 | /* 53 | * XXX - do we need any of this if doesn't declare 54 | * ether_hostton()? 55 | */ 56 | #ifdef HAVE_NETINET_IF_ETHER_H 57 | struct mbuf; /* Squelch compiler warnings on some platforms for */ 58 | struct rtentry; /* declarations in */ 59 | #include /* for "struct ifnet" in "struct arpcom" on Solaris */ 60 | #include 61 | #endif /* HAVE_NETINET_IF_ETHER_H */ 62 | #ifdef NETINET_ETHER_H_DECLARES_ETHER_HOSTTON 63 | #include 64 | #endif /* NETINET_ETHER_H_DECLARES_ETHER_HOSTTON */ 65 | #endif /* HAVE_ETHER_HOSTTON */ 66 | #include 67 | #include 68 | #endif /* WIN32 */ 69 | 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | 76 | #include "sfbpf-int.h" 77 | 78 | #include "gencode.h" 79 | #include "namedb.h" 80 | 81 | #ifndef NTOHL 82 | #define NTOHL(x) (x) = ntohl(x) 83 | #define NTOHS(x) (x) = ntohs(x) 84 | #endif 85 | 86 | static inline int xdtoi(int); 87 | 88 | /* 89 | * Convert host name to internet address. 90 | * Return 0 upon failure. 91 | */ 92 | bpf_u_int32 **pcap_nametoaddr(const char *name) 93 | { 94 | #ifndef h_addr 95 | static bpf_u_int32 *hlist[2]; 96 | #endif 97 | bpf_u_int32 **p; 98 | struct hostent *hp; 99 | 100 | if ((hp = gethostbyname(name)) != NULL) 101 | { 102 | #ifndef h_addr 103 | hlist[0] = (bpf_u_int32 *) hp->h_addr; 104 | NTOHL(hp->h_addr); 105 | return hlist; 106 | #else 107 | for (p = (bpf_u_int32 **) hp->h_addr_list; *p; ++p) 108 | NTOHL(**p); 109 | return (bpf_u_int32 **) hp->h_addr_list; 110 | #endif 111 | } 112 | else 113 | return 0; 114 | } 115 | 116 | #ifdef INET6 117 | struct addrinfo *pcap_nametoaddrinfo(const char *name) 118 | { 119 | struct addrinfo hints, *res; 120 | int error; 121 | 122 | memset(&hints, 0, sizeof(hints)); 123 | hints.ai_family = PF_UNSPEC; 124 | hints.ai_socktype = SOCK_STREAM; /*not really */ 125 | hints.ai_protocol = IPPROTO_TCP; /*not really */ 126 | error = getaddrinfo(name, NULL, &hints, &res); 127 | if (error) 128 | return NULL; 129 | else 130 | return res; 131 | } 132 | #endif /*INET6 */ 133 | 134 | /* 135 | * Convert net name to internet address. 136 | * Return 0 upon failure. 137 | */ 138 | bpf_u_int32 pcap_nametonetaddr(const char *name) 139 | { 140 | #ifndef WIN32 141 | struct netent *np; 142 | 143 | if ((np = getnetbyname(name)) != NULL) 144 | return np->n_net; 145 | else 146 | return 0; 147 | #else 148 | /* 149 | * There's no "getnetbyname()" on Windows. 150 | */ 151 | return 0; 152 | #endif 153 | } 154 | 155 | /* 156 | * Convert a port name to its port and protocol numbers. 157 | * We assume only TCP or UDP. 158 | * Return 0 upon failure. 159 | */ 160 | int pcap_nametoport(const char *name, int *port, int *proto) 161 | { 162 | struct servent *sp; 163 | int tcp_port = -1; 164 | int udp_port = -1; 165 | 166 | /* 167 | * We need to check /etc/services for ambiguous entries. 168 | * If we find the ambiguous entry, and it has the 169 | * same port number, change the proto to PROTO_UNDEF 170 | * so both TCP and UDP will be checked. 171 | */ 172 | sp = getservbyname(name, "tcp"); 173 | if (sp != NULL) 174 | tcp_port = ntohs(sp->s_port); 175 | sp = getservbyname(name, "udp"); 176 | if (sp != NULL) 177 | udp_port = ntohs(sp->s_port); 178 | if (tcp_port >= 0) 179 | { 180 | *port = tcp_port; 181 | *proto = IPPROTO_TCP; 182 | if (udp_port >= 0) 183 | { 184 | if (udp_port == tcp_port) 185 | *proto = PROTO_UNDEF; 186 | #ifdef notdef 187 | else 188 | /* Can't handle ambiguous names that refer 189 | to different port numbers. */ 190 | warning("ambiguous port %s in /etc/services", name); 191 | #endif 192 | } 193 | return 1; 194 | } 195 | if (udp_port >= 0) 196 | { 197 | *port = udp_port; 198 | *proto = IPPROTO_UDP; 199 | return 1; 200 | } 201 | #if defined(ultrix) || defined(__osf__) 202 | /* Special hack in case NFS isn't in /etc/services */ 203 | if (strcmp(name, "nfs") == 0) 204 | { 205 | *port = 2049; 206 | *proto = PROTO_UNDEF; 207 | return 1; 208 | } 209 | #endif 210 | return 0; 211 | } 212 | 213 | /* 214 | * Convert a string in the form PPP-PPP, where correspond to ports, to 215 | * a starting and ending port in a port range. 216 | * Return 0 on failure. 217 | */ 218 | int pcap_nametoportrange(const char *name, int *port1, int *port2, int *proto) 219 | { 220 | u_int p1, p2; 221 | char *off, *cpy; 222 | int save_proto; 223 | 224 | if (sscanf(name, "%u-%u", &p1, &p2) != 2) 225 | { 226 | if ((cpy = strdup(name)) == NULL) 227 | return 0; 228 | 229 | if ((off = strchr(cpy, '-')) == NULL) 230 | { 231 | free(cpy); 232 | return 0; 233 | } 234 | 235 | *off = '\0'; 236 | 237 | if (pcap_nametoport(cpy, port1, proto) == 0) 238 | { 239 | free(cpy); 240 | return 0; 241 | } 242 | save_proto = *proto; 243 | 244 | if (pcap_nametoport(off + 1, port2, proto) == 0) 245 | { 246 | free(cpy); 247 | return 0; 248 | } 249 | 250 | if (*proto != save_proto) 251 | *proto = PROTO_UNDEF; 252 | } 253 | else 254 | { 255 | *port1 = p1; 256 | *port2 = p2; 257 | *proto = PROTO_UNDEF; 258 | } 259 | 260 | return 1; 261 | } 262 | 263 | int pcap_nametoproto(const char *str) 264 | { 265 | struct protoent *p; 266 | 267 | p = getprotobyname(str); 268 | if (p != 0) 269 | return p->p_proto; 270 | else 271 | return PROTO_UNDEF; 272 | } 273 | 274 | #include "ethertype.h" 275 | 276 | struct eproto 277 | { 278 | const char *s; 279 | u_short p; 280 | }; 281 | 282 | /* Static data base of ether protocol types. */ 283 | struct eproto eproto_db[] = { 284 | {"pup", ETHERTYPE_PUP}, 285 | {"xns", ETHERTYPE_NS}, 286 | {"ip", ETHERTYPE_IP}, 287 | #ifdef INET6 288 | {"ip6", ETHERTYPE_IPV6}, 289 | #endif 290 | {"arp", ETHERTYPE_ARP}, 291 | {"rarp", ETHERTYPE_REVARP}, 292 | {"sprite", ETHERTYPE_SPRITE}, 293 | {"mopdl", ETHERTYPE_MOPDL}, 294 | {"moprc", ETHERTYPE_MOPRC}, 295 | {"decnet", ETHERTYPE_DN}, 296 | {"lat", ETHERTYPE_LAT}, 297 | {"sca", ETHERTYPE_SCA}, 298 | {"lanbridge", ETHERTYPE_LANBRIDGE}, 299 | {"vexp", ETHERTYPE_VEXP}, 300 | {"vprod", ETHERTYPE_VPROD}, 301 | {"atalk", ETHERTYPE_ATALK}, 302 | {"atalkarp", ETHERTYPE_AARP}, 303 | {"loopback", ETHERTYPE_LOOPBACK}, 304 | {"decdts", ETHERTYPE_DECDTS}, 305 | {"decdns", ETHERTYPE_DECDNS}, 306 | {(char *) 0, 0} 307 | }; 308 | 309 | int pcap_nametoeproto(const char *s) 310 | { 311 | struct eproto *p = eproto_db; 312 | 313 | while (p->s != 0) 314 | { 315 | if (strcmp(p->s, s) == 0) 316 | return p->p; 317 | p += 1; 318 | } 319 | return PROTO_UNDEF; 320 | } 321 | 322 | #include "llc.h" 323 | 324 | /* Static data base of LLC values. */ 325 | static struct eproto llc_db[] = { 326 | {"iso", LLCSAP_ISONS}, 327 | {"stp", LLCSAP_8021D}, 328 | {"ipx", LLCSAP_IPX}, 329 | {"netbeui", LLCSAP_NETBEUI}, 330 | {(char *) 0, 0} 331 | }; 332 | 333 | int pcap_nametollc(const char *s) 334 | { 335 | struct eproto *p = llc_db; 336 | 337 | while (p->s != 0) 338 | { 339 | if (strcmp(p->s, s) == 0) 340 | return p->p; 341 | p += 1; 342 | } 343 | return PROTO_UNDEF; 344 | } 345 | 346 | /* Hex digit to integer. */ 347 | static inline int xdtoi(c) 348 | register int c; 349 | { 350 | if (isdigit(c)) 351 | return c - '0'; 352 | else if (islower(c)) 353 | return c - 'a' + 10; 354 | else 355 | return c - 'A' + 10; 356 | } 357 | 358 | int __pcap_atoin(const char *s, bpf_u_int32 *addr) 359 | { 360 | u_int n; 361 | int len; 362 | 363 | *addr = 0; 364 | len = 0; 365 | while (1) 366 | { 367 | n = 0; 368 | while (*s && *s != '.') 369 | n = n * 10 + *s++ - '0'; 370 | *addr <<= 8; 371 | *addr |= n & 0xff; 372 | len += 8; 373 | if (*s == '\0') 374 | return len; 375 | ++s; 376 | } 377 | /* NOTREACHED */ 378 | } 379 | 380 | int __pcap_atodn(const char *s, bpf_u_int32 *addr) 381 | { 382 | #define AREASHIFT 10 383 | #define AREAMASK 0176000 384 | #define NODEMASK 01777 385 | 386 | u_int node, area; 387 | 388 | if (sscanf(s, "%u.%u", &area, &node) != 2) 389 | bpf_error("malformed decnet address '%s'", s); 390 | 391 | *addr = (area << AREASHIFT) & AREAMASK; 392 | *addr |= (node & NODEMASK); 393 | 394 | return (32); 395 | } 396 | 397 | /* 398 | * Convert 's', which can have the one of the forms: 399 | * 400 | * "xx:xx:xx:xx:xx:xx" 401 | * "xx.xx.xx.xx.xx.xx" 402 | * "xx-xx-xx-xx-xx-xx" 403 | * "xxxx.xxxx.xxxx" 404 | * "xxxxxxxxxxxx" 405 | * 406 | * (or various mixes of ':', '.', and '-') into a new 407 | * ethernet address. Assumes 's' is well formed. 408 | */ 409 | u_char *pcap_ether_aton(const char *s) 410 | { 411 | register u_char *ep, *e; 412 | register u_int d; 413 | 414 | e = ep = (u_char *) malloc(6); 415 | if (!e) 416 | return(NULL); 417 | 418 | while (*s) 419 | { 420 | if (*s == ':' || *s == '.' || *s == '-') 421 | s += 1; 422 | d = xdtoi(*s++); 423 | if (isxdigit((unsigned char) *s)) 424 | { 425 | d <<= 4; 426 | d |= xdtoi(*s++); 427 | } 428 | *ep++ = d; 429 | } 430 | 431 | return (e); 432 | } 433 | 434 | #ifndef HAVE_ETHER_HOSTTON 435 | /* Roll our own */ 436 | u_char *pcap_ether_hostton(const char *name) 437 | { 438 | register struct pcap_etherent *ep; 439 | register u_char *ap; 440 | static FILE *fp = NULL; 441 | static int init = 0; 442 | 443 | if (!init) 444 | { 445 | fp = fopen(PCAP_ETHERS_FILE, "r"); 446 | ++init; 447 | if (fp == NULL) 448 | return (NULL); 449 | } 450 | else if (fp == NULL) 451 | return (NULL); 452 | else 453 | rewind(fp); 454 | 455 | while ((ep = pcap_next_etherent(fp)) != NULL) 456 | { 457 | if (strcmp(ep->name, name) == 0) 458 | { 459 | ap = (u_char *) malloc(6); 460 | if (ap != NULL) 461 | { 462 | memcpy(ap, ep->addr, 6); 463 | return (ap); 464 | } 465 | break; 466 | } 467 | } 468 | return (NULL); 469 | } 470 | #else 471 | 472 | #if !defined(HAVE_DECL_ETHER_HOSTTON) || !HAVE_DECL_ETHER_HOSTTON 473 | #ifndef HAVE_STRUCT_ETHER_ADDR 474 | struct ether_addr 475 | { 476 | unsigned char ether_addr_octet[6]; 477 | }; 478 | #endif 479 | extern int ether_hostton(const char *, struct ether_addr *); 480 | #endif 481 | 482 | /* Use the os supplied routines */ 483 | u_char *pcap_ether_hostton(const char *name) 484 | { 485 | register u_char *ap; 486 | u_char a[6]; 487 | 488 | ap = NULL; 489 | if (ether_hostton(name, (struct ether_addr *) a) == 0) 490 | { 491 | ap = (u_char *) malloc(6); 492 | if (ap != NULL) 493 | memcpy((char *) ap, (char *) a, 6); 494 | } 495 | return (ap); 496 | } 497 | #endif 498 | 499 | u_short __pcap_nametodnaddr(const char *name) 500 | { 501 | #ifdef DECNETLIB 502 | struct nodeent *getnodebyname(); 503 | struct nodeent *nep; 504 | unsigned short res; 505 | 506 | nep = getnodebyname(name); 507 | if (nep == ((struct nodeent *) 0)) 508 | bpf_error("unknown decnet host name '%s'\n", name); 509 | 510 | memcpy((char *) &res, (char *) nep->n_addr, sizeof(unsigned short)); 511 | return (res); 512 | #else 513 | bpf_error("decnet name support not included, '%s' cannot be translated\n", name); 514 | return (0); 515 | #endif 516 | } 517 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/sfbpf-int.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Some portions Copyright (C) 2010-2013 Sourcefire, Inc. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that: (1) source code distributions 9 | * retain the above copyright notice and this paragraph in its entirety, (2) 10 | * distributions including binary code include the above copyright notice and 11 | * this paragraph in its entirety in the documentation or other materials 12 | * provided with the distribution, and (3) all advertising materials mentioning 13 | * features or use of this software display the following acknowledgement: 14 | * ``This product includes software developed by the University of California, 15 | * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 16 | * the University nor the names of its contributors may be used to endorse 17 | * or promote products derived from this software without specific prior 18 | * written permission. 19 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 20 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 21 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 22 | */ 23 | 24 | /* 25 | * This file mostly consists of code extraced from libpcap as required by the 26 | * BPF library. It originates from multiple files in the original libpcap 27 | * distribution. 28 | */ 29 | 30 | #ifdef HAVE_CONFIG_H 31 | #include "config.h" 32 | #endif 33 | 34 | #include 35 | #ifndef WIN32 36 | #include 37 | #endif 38 | #include 39 | #include 40 | #include 41 | #include "sfbpf-int.h" 42 | #include "namedb.h" 43 | #include "gencode.h" 44 | 45 | /* 46 | * This array is designed for mapping upper and lower case letter 47 | * together for a case independent comparison. The mappings are 48 | * based upon ascii character sequences. 49 | */ 50 | static const u_char charmap[] = { 51 | (u_char) '\000', (u_char) '\001', (u_char) '\002', (u_char) '\003', 52 | (u_char) '\004', (u_char) '\005', (u_char) '\006', (u_char) '\007', 53 | (u_char) '\010', (u_char) '\011', (u_char) '\012', (u_char) '\013', 54 | (u_char) '\014', (u_char) '\015', (u_char) '\016', (u_char) '\017', 55 | (u_char) '\020', (u_char) '\021', (u_char) '\022', (u_char) '\023', 56 | (u_char) '\024', (u_char) '\025', (u_char) '\026', (u_char) '\027', 57 | (u_char) '\030', (u_char) '\031', (u_char) '\032', (u_char) '\033', 58 | (u_char) '\034', (u_char) '\035', (u_char) '\036', (u_char) '\037', 59 | (u_char) '\040', (u_char) '\041', (u_char) '\042', (u_char) '\043', 60 | (u_char) '\044', (u_char) '\045', (u_char) '\046', (u_char) '\047', 61 | (u_char) '\050', (u_char) '\051', (u_char) '\052', (u_char) '\053', 62 | (u_char) '\054', (u_char) '\055', (u_char) '\056', (u_char) '\057', 63 | (u_char) '\060', (u_char) '\061', (u_char) '\062', (u_char) '\063', 64 | (u_char) '\064', (u_char) '\065', (u_char) '\066', (u_char) '\067', 65 | (u_char) '\070', (u_char) '\071', (u_char) '\072', (u_char) '\073', 66 | (u_char) '\074', (u_char) '\075', (u_char) '\076', (u_char) '\077', 67 | (u_char) '\100', (u_char) '\141', (u_char) '\142', (u_char) '\143', 68 | (u_char) '\144', (u_char) '\145', (u_char) '\146', (u_char) '\147', 69 | (u_char) '\150', (u_char) '\151', (u_char) '\152', (u_char) '\153', 70 | (u_char) '\154', (u_char) '\155', (u_char) '\156', (u_char) '\157', 71 | (u_char) '\160', (u_char) '\161', (u_char) '\162', (u_char) '\163', 72 | (u_char) '\164', (u_char) '\165', (u_char) '\166', (u_char) '\167', 73 | (u_char) '\170', (u_char) '\171', (u_char) '\172', (u_char) '\133', 74 | (u_char) '\134', (u_char) '\135', (u_char) '\136', (u_char) '\137', 75 | (u_char) '\140', (u_char) '\141', (u_char) '\142', (u_char) '\143', 76 | (u_char) '\144', (u_char) '\145', (u_char) '\146', (u_char) '\147', 77 | (u_char) '\150', (u_char) '\151', (u_char) '\152', (u_char) '\153', 78 | (u_char) '\154', (u_char) '\155', (u_char) '\156', (u_char) '\157', 79 | (u_char) '\160', (u_char) '\161', (u_char) '\162', (u_char) '\163', 80 | (u_char) '\164', (u_char) '\165', (u_char) '\166', (u_char) '\167', 81 | (u_char) '\170', (u_char) '\171', (u_char) '\172', (u_char) '\173', 82 | (u_char) '\174', (u_char) '\175', (u_char) '\176', (u_char) '\177', 83 | (u_char) '\200', (u_char) '\201', (u_char) '\202', (u_char) '\203', 84 | (u_char) '\204', (u_char) '\205', (u_char) '\206', (u_char) '\207', 85 | (u_char) '\210', (u_char) '\211', (u_char) '\212', (u_char) '\213', 86 | (u_char) '\214', (u_char) '\215', (u_char) '\216', (u_char) '\217', 87 | (u_char) '\220', (u_char) '\221', (u_char) '\222', (u_char) '\223', 88 | (u_char) '\224', (u_char) '\225', (u_char) '\226', (u_char) '\227', 89 | (u_char) '\230', (u_char) '\231', (u_char) '\232', (u_char) '\233', 90 | (u_char) '\234', (u_char) '\235', (u_char) '\236', (u_char) '\237', 91 | (u_char) '\240', (u_char) '\241', (u_char) '\242', (u_char) '\243', 92 | (u_char) '\244', (u_char) '\245', (u_char) '\246', (u_char) '\247', 93 | (u_char) '\250', (u_char) '\251', (u_char) '\252', (u_char) '\253', 94 | (u_char) '\254', (u_char) '\255', (u_char) '\256', (u_char) '\257', 95 | (u_char) '\260', (u_char) '\261', (u_char) '\262', (u_char) '\263', 96 | (u_char) '\264', (u_char) '\265', (u_char) '\266', (u_char) '\267', 97 | (u_char) '\270', (u_char) '\271', (u_char) '\272', (u_char) '\273', 98 | (u_char) '\274', (u_char) '\275', (u_char) '\276', (u_char) '\277', 99 | (u_char) '\300', (u_char) '\341', (u_char) '\342', (u_char) '\343', 100 | (u_char) '\344', (u_char) '\345', (u_char) '\346', (u_char) '\347', 101 | (u_char) '\350', (u_char) '\351', (u_char) '\352', (u_char) '\353', 102 | (u_char) '\354', (u_char) '\355', (u_char) '\356', (u_char) '\357', 103 | (u_char) '\360', (u_char) '\361', (u_char) '\362', (u_char) '\363', 104 | (u_char) '\364', (u_char) '\365', (u_char) '\366', (u_char) '\367', 105 | (u_char) '\370', (u_char) '\371', (u_char) '\372', (u_char) '\333', 106 | (u_char) '\334', (u_char) '\335', (u_char) '\336', (u_char) '\337', 107 | (u_char) '\340', (u_char) '\341', (u_char) '\342', (u_char) '\343', 108 | (u_char) '\344', (u_char) '\345', (u_char) '\346', (u_char) '\347', 109 | (u_char) '\350', (u_char) '\351', (u_char) '\352', (u_char) '\353', 110 | (u_char) '\354', (u_char) '\355', (u_char) '\356', (u_char) '\357', 111 | (u_char) '\360', (u_char) '\361', (u_char) '\362', (u_char) '\363', 112 | (u_char) '\364', (u_char) '\365', (u_char) '\366', (u_char) '\367', 113 | (u_char) '\370', (u_char) '\371', (u_char) '\372', (u_char) '\373', 114 | (u_char) '\374', (u_char) '\375', (u_char) '\376', (u_char) '\377', 115 | }; 116 | 117 | int sfbpf_strcasecmp(const char *s1, const char *s2) 118 | { 119 | register const u_char *cm = charmap, *us1 = (const u_char *) s1, *us2 = (const u_char *) s2; 120 | 121 | while (cm[*us1] == cm[*us2++]) 122 | if (*us1++ == '\0') 123 | return (0); 124 | return (cm[*us1] - cm[*--us2]); 125 | } 126 | 127 | /* Hex digit to integer. */ 128 | static inline int xdtoi(c) 129 | register int c; 130 | { 131 | if (isdigit(c)) 132 | return c - '0'; 133 | else if (islower(c)) 134 | return c - 'a' + 10; 135 | else 136 | return c - 'A' + 10; 137 | } 138 | 139 | static inline int skip_space(f) 140 | FILE *f; 141 | { 142 | int c; 143 | 144 | do 145 | { 146 | c = getc(f); 147 | } while (isspace(c) && c != '\n'); 148 | 149 | return c; 150 | } 151 | 152 | static inline int skip_line(f) 153 | FILE *f; 154 | { 155 | int c; 156 | 157 | do 158 | c = getc(f); 159 | while (c != '\n' && c != EOF); 160 | 161 | return c; 162 | } 163 | 164 | struct pcap_etherent *pcap_next_etherent(FILE * fp) 165 | { 166 | register int c, d, i; 167 | char *bp; 168 | static struct pcap_etherent e; 169 | 170 | memset((char *) &e, 0, sizeof(e)); 171 | do 172 | { 173 | /* Find addr */ 174 | c = skip_space(fp); 175 | if (c == '\n') 176 | continue; 177 | 178 | /* If this is a comment, or first thing on line 179 | cannot be etehrnet address, skip the line. */ 180 | if (!isxdigit(c)) 181 | { 182 | c = skip_line(fp); 183 | continue; 184 | } 185 | 186 | /* must be the start of an address */ 187 | for (i = 0; i < 6; i += 1) 188 | { 189 | d = xdtoi(c); 190 | c = getc(fp); 191 | if (isxdigit(c)) 192 | { 193 | d <<= 4; 194 | d |= xdtoi(c); 195 | c = getc(fp); 196 | } 197 | e.addr[i] = d; 198 | if (c != ':') 199 | break; 200 | c = getc(fp); 201 | } 202 | if (c == EOF) 203 | break; 204 | 205 | /* Must be whitespace */ 206 | if (!isspace(c)) 207 | { 208 | c = skip_line(fp); 209 | continue; 210 | } 211 | c = skip_space(fp); 212 | 213 | /* hit end of line... */ 214 | if (c == '\n') 215 | continue; 216 | 217 | if (c == '#') 218 | { 219 | c = skip_line(fp); 220 | continue; 221 | } 222 | 223 | /* pick up name */ 224 | bp = e.name; 225 | /* Use 'd' to prevent buffer overflow. */ 226 | d = sizeof(e.name) - 1; 227 | do 228 | { 229 | *bp++ = c; 230 | c = getc(fp); 231 | } while (!isspace(c) && c != EOF && --d > 0); 232 | *bp = '\0'; 233 | 234 | /* Eat trailing junk */ 235 | if (c != '\n') 236 | (void) skip_line(fp); 237 | 238 | return &e; 239 | 240 | } while (c != EOF); 241 | 242 | return (NULL); 243 | } 244 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/sfbpf-int.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Some portions Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved. 6 | * Some portions Copyright (C) 2010-2013 Sourcefire, Inc. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that: (1) source code distributions 10 | * retain the above copyright notice and this paragraph in its entirety, (2) 11 | * distributions including binary code include the above copyright notice and 12 | * this paragraph in its entirety in the documentation or other materials 13 | * provided with the distribution, and (3) all advertising materials mentioning 14 | * features or use of this software display the following acknowledgement: 15 | * ``This product includes software developed by the University of California, 16 | * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 17 | * the University nor the names of its contributors may be used to endorse 18 | * or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 23 | */ 24 | 25 | #ifndef _SFBPF_INT_H 26 | #define _SFBPF_INT_H 27 | 28 | #ifdef HAVE_VISIBILITY 29 | # define DAQ_SO_PUBLIC __attribute__ ((visibility("default"))) 30 | # define DAQ_SO_PRIVATE __attribute__ ((visibility("hidden"))) 31 | #else 32 | # define DAQ_SO_PUBLIC 33 | # define DAQ_SO_PRIVATE 34 | #endif 35 | 36 | #include "sfbpf.h" 37 | #include "sf-redefines.h" 38 | 39 | #define PCAP_ERRBUF_SIZE 256 40 | 41 | #ifndef strlcpy 42 | #define strlcpy(x, y, z) \ 43 | (strncpy((x), (y), (z)), \ 44 | ((z) <= 0 ? 0 : ((x)[(z) - 1] = '\0')), \ 45 | strlen((y))) 46 | #endif 47 | 48 | int yylex(void); 49 | int sfbpf_strcasecmp(const char *s1, const char *s2); 50 | 51 | #define SFBPF_NETMASK_UNKNOWN 0xffffffff 52 | 53 | #endif /* _SFBPF_INT_H */ 54 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/sfbpf.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Some portions Copyright (C) 2010-2013 Sourcefire, Inc. 6 | * 7 | * This code is derived from the Stanford/CMU enet packet filter, 8 | * (net/enet.c) distributed as part of 4.3BSD, and code contributed 9 | * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 10 | * Berkeley Laboratory. 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 1. Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 3. All advertising materials mentioning features or use of this software 21 | * must display the following acknowledgement: 22 | * This product includes software developed by the University of 23 | * California, Berkeley and its contributors. 24 | * 4. Neither the name of the University nor the names of its contributors 25 | * may be used to endorse or promote products derived from this software 26 | * without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 29 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 32 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 37 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 38 | * SUCH DAMAGE. 39 | * 40 | * @(#)bpf.h 7.1 (Berkeley) 5/7/91 41 | * 42 | */ 43 | 44 | /* 45 | * This is libDAQ's cut-down version of libpcap's cut-down version of bpf.h; 46 | * it includes only the stuff needed for the code generator and the userland 47 | * BPF interpreter, and the libDAQ APIs for setting filters, etc.. 48 | * 49 | * Mostly things have been renamed so as to not conflict with the original 50 | * libpcap BPF headers. 51 | * 52 | * Datalink type definitions have been extracted and placed in sfbpf_dlt.h. 53 | */ 54 | 55 | #ifndef _SFBPF_H 56 | #define _SFBPF_H 57 | 58 | #include 59 | 60 | #ifdef __cplusplus 61 | extern "C" { 62 | #endif 63 | 64 | /* BSD style release date */ 65 | #define SFBPF_RELEASE 199606 66 | 67 | typedef int sfbpf_int32; 68 | typedef u_int sfbpf_u_int32; 69 | 70 | /* 71 | * Alignment macros. SFBPF_WORDALIGN rounds up to the next 72 | * even multiple of SFBPF_ALIGNMENT. 73 | */ 74 | #define SFBPF_ALIGNMENT sizeof(sfbpf_int32) 75 | #define SFBPF_WORDALIGN(x) (((x)+(SFBPF_ALIGNMENT-1))&~(SFBPF_ALIGNMENT-1)) 76 | 77 | #define SFBPF_MAXBUFSIZE 0x8000 78 | #define SFBPF_MINBUFSIZE 32 79 | 80 | /* 81 | * Structure for "pcap_compile()", "pcap_setfilter()", etc.. 82 | */ 83 | struct sfbpf_program { 84 | u_int bf_len; 85 | struct sfbpf_insn *bf_insns; 86 | }; 87 | 88 | /* 89 | * Struct return by BIOCVERSION. This represents the version number of 90 | * the filter language described by the instruction encodings below. 91 | * bpf understands a program iff kernel_major == filter_major && 92 | * kernel_minor >= filter_minor, that is, if the value returned by the 93 | * running kernel has the same major number and a minor number equal 94 | * equal to or less than the filter being downloaded. Otherwise, the 95 | * results are undefined, meaning an error may be returned or packets 96 | * may be accepted haphazardly. 97 | * It has nothing to do with the source code version. 98 | */ 99 | struct sfbpf_version { 100 | u_short bv_major; 101 | u_short bv_minor; 102 | }; 103 | /* Current version number of filter architecture. */ 104 | #define SFBPF_MAJOR_VERSION 1 105 | #define SFBPF_MINOR_VERSION 1 106 | 107 | #include 108 | 109 | /* 110 | * The instruction encodings. 111 | */ 112 | /* instruction classes */ 113 | #define SFBPF_CLASS(code) ((code) & 0x07) 114 | #define SFBPF_LD 0x00 115 | #define SFBPF_LDX 0x01 116 | #define SFBPF_ST 0x02 117 | #define SFBPF_STX 0x03 118 | #define SFBPF_ALU 0x04 119 | #define SFBPF_JMP 0x05 120 | #define SFBPF_RET 0x06 121 | #define SFBPF_MISC 0x07 122 | 123 | /* ld/ldx fields */ 124 | #define SFBPF_SIZE(code) ((code) & 0x18) 125 | #define SFBPF_W 0x00 126 | #define SFBPF_H 0x08 127 | #define SFBPF_B 0x10 128 | #define SFBPF_MODE(code) ((code) & 0xe0) 129 | #define SFBPF_IMM 0x00 130 | #define SFBPF_ABS 0x20 131 | #define SFBPF_IND 0x40 132 | #define SFBPF_MEM 0x60 133 | #define SFBPF_LEN 0x80 134 | #define SFBPF_MSH 0xa0 135 | 136 | /* alu/jmp fields */ 137 | #define SFBPF_OP(code) ((code) & 0xf0) 138 | #define SFBPF_ADD 0x00 139 | #define SFBPF_SUB 0x10 140 | #define SFBPF_MUL 0x20 141 | #define SFBPF_DIV 0x30 142 | #define SFBPF_OR 0x40 143 | #define SFBPF_AND 0x50 144 | #define SFBPF_LSH 0x60 145 | #define SFBPF_RSH 0x70 146 | #define SFBPF_NEG 0x80 147 | #define SFBPF_JA 0x00 148 | #define SFBPF_JEQ 0x10 149 | #define SFBPF_JGT 0x20 150 | #define SFBPF_JGE 0x30 151 | #define SFBPF_JSET 0x40 152 | #define SFBPF_SRC(code) ((code) & 0x08) 153 | #define SFBPF_K 0x00 154 | #define SFBPF_X 0x08 155 | 156 | /* ret - SFBPF_K and SFBPF_X also apply */ 157 | #define SFBPF_RVAL(code) ((code) & 0x18) 158 | #define SFBPF_A 0x10 159 | 160 | /* misc */ 161 | #define SFBPF_MISCOP(code) ((code) & 0xf8) 162 | #define SFBPF_TAX 0x00 163 | #define SFBPF_TXA 0x80 164 | 165 | /* 166 | * The instruction data structure. 167 | */ 168 | struct sfbpf_insn { 169 | u_short code; 170 | u_char jt; 171 | u_char jf; 172 | sfbpf_u_int32 k; 173 | }; 174 | 175 | /* 176 | * Macros for insn array initializers. 177 | */ 178 | #define SFBPF_STMT(code, k) { (u_short)(code), 0, 0, k } 179 | #define SFBPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } 180 | 181 | //#if __STDC__ || defined(__cplusplus) 182 | int sfbpf_compile(int snaplen_arg, int linktype_arg, struct sfbpf_program *program, const char *buf, int optimize, sfbpf_u_int32 mask); 183 | int sfbpf_validate(const struct sfbpf_insn *f, int len); 184 | u_int sfbpf_filter(const struct sfbpf_insn *pc, const u_char *p, u_int wirelen, u_int buflen); 185 | void sfbpf_freecode(struct sfbpf_program *program); 186 | void sfbpf_print(struct sfbpf_program *fp, int verbose); 187 | /* 188 | #else 189 | int sfbpf_compile(); 190 | int sfbpf_validate(); 191 | u_int sfbpf_filter(); 192 | void sfbpf_freecode(); 193 | #endif 194 | */ 195 | /* 196 | * Number of scratch memory words (for SFBPF_LD|SFBPF_MEM and SFBPF_ST). 197 | */ 198 | #define SFBPF_MEMWORDS 16 199 | 200 | #ifdef __cplusplus 201 | } 202 | #endif 203 | 204 | #endif 205 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/sll.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * This code is derived from the Stanford/CMU enet packet filter, 6 | * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7 | * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 8 | * Berkeley Laboratory. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 3. All advertising materials mentioning features or use of this software 19 | * must display the following acknowledgement: 20 | * This product includes software developed by the University of 21 | * California, Berkeley and its contributors. 22 | * 4. Neither the name of the University nor the names of its contributors 23 | * may be used to endorse or promote products derived from this software 24 | * without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 | * SUCH DAMAGE. 37 | * 38 | */ 39 | 40 | /* 41 | * For captures on Linux cooked sockets, we construct a fake header 42 | * that includes: 43 | * 44 | * a 2-byte "packet type" which is one of: 45 | * 46 | * LINUX_SLL_HOST packet was sent to us 47 | * LINUX_SLL_BROADCAST packet was broadcast 48 | * LINUX_SLL_MULTICAST packet was multicast 49 | * LINUX_SLL_OTHERHOST packet was sent to somebody else 50 | * LINUX_SLL_OUTGOING packet was sent *by* us; 51 | * 52 | * a 2-byte Ethernet protocol field; 53 | * 54 | * a 2-byte link-layer type; 55 | * 56 | * a 2-byte link-layer address length; 57 | * 58 | * an 8-byte source link-layer address, whose actual length is 59 | * specified by the previous value. 60 | * 61 | * All fields except for the link-layer address are in network byte order. 62 | * 63 | * DO NOT change the layout of this structure, or change any of the 64 | * LINUX_SLL_ values below. If you must change the link-layer header 65 | * for a "cooked" Linux capture, introduce a new DLT_ type (ask 66 | * "tcpdump-workers@lists.tcpdump.org" for one, so that you don't give it 67 | * a value that collides with a value already being used), and use the 68 | * new header in captures of that type, so that programs that can 69 | * handle DLT_LINUX_SLL captures will continue to handle them correctly 70 | * without any change, and so that capture files with different headers 71 | * can be told apart and programs that read them can dissect the 72 | * packets in them. 73 | */ 74 | 75 | #ifndef lib_pcap_sll_h 76 | #define lib_pcap_sll_h 77 | 78 | /* 79 | * A DLT_LINUX_SLL fake link-layer header. 80 | */ 81 | #define SLL_HDR_LEN 16 /* total header length */ 82 | #define SLL_ADDRLEN 8 /* length of address field */ 83 | 84 | #if defined (__SVR4) && defined (__sun) 85 | 86 | typedef uint8_t u_int8_t; 87 | typedef uint16_t u_int16_t; 88 | 89 | #endif /* defined (__SVR4) && defined (__sun) */ 90 | 91 | struct sll_header 92 | { 93 | u_int16_t sll_pkttype; /* packet type */ 94 | u_int16_t sll_hatype; /* link-layer address type */ 95 | u_int16_t sll_halen; /* link-layer address length */ 96 | u_int8_t sll_addr[SLL_ADDRLEN]; /* link-layer address */ 97 | u_int16_t sll_protocol; /* protocol */ 98 | }; 99 | 100 | /* 101 | * The LINUX_SLL_ values for "sll_pkttype"; these correspond to the 102 | * PACKET_ values on Linux, but are defined here so that they're 103 | * available even on systems other than Linux, and so that they 104 | * don't change even if the PACKET_ values change. 105 | */ 106 | #define LINUX_SLL_HOST 0 107 | #define LINUX_SLL_BROADCAST 1 108 | #define LINUX_SLL_MULTICAST 2 109 | #define LINUX_SLL_OTHERHOST 3 110 | #define LINUX_SLL_OUTGOING 4 111 | 112 | /* 113 | * The LINUX_SLL_ values for "sll_protocol"; these correspond to the 114 | * ETH_P_ values on Linux, but are defined here so that they're 115 | * available even on systems other than Linux. We assume, for now, 116 | * that the ETH_P_ values won't change in Linux; if they do, then: 117 | * 118 | * if we don't translate them in "pcap-linux.c", capture files 119 | * won't necessarily be readable if captured on a system that 120 | * defines ETH_P_ values that don't match these values; 121 | * 122 | * if we do translate them in "pcap-linux.c", that makes life 123 | * unpleasant for the BPF code generator, as the values you test 124 | * for in the kernel aren't the values that you test for when 125 | * reading a capture file, so the fixup code run on BPF programs 126 | * handed to the kernel ends up having to do more work. 127 | * 128 | * Add other values here as necessary, for handling packet types that 129 | * might show up on non-Ethernet, non-802.x networks. (Not all the ones 130 | * in the Linux "if_ether.h" will, I suspect, actually show up in 131 | * captures.) 132 | */ 133 | #define LINUX_SLL_P_802_3 0x0001 /* Novell 802.3 frames without 802.2 LLC header */ 134 | #define LINUX_SLL_P_802_2 0x0004 /* 802.2 frames (not D/I/X Ethernet) */ 135 | 136 | #endif 137 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/sunatmpos.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997 Yen Yen Lim and North Dakota State University 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by Yen Yen Lim and 16 | North Dakota State University 17 | * 4. The name of the author may not be used to endorse or promote products 18 | * derived from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 29 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | 34 | /* SunATM header for ATM packet */ 35 | #define SUNATM_DIR_POS 0 36 | #define SUNATM_VPI_POS 1 37 | #define SUNATM_VCI_POS 2 38 | #define SUNATM_PKT_BEGIN_POS 4 /* Start of ATM packet */ 39 | 40 | /* Protocol type values in the bottom for bits of the byte at SUNATM_DIR_POS. */ 41 | #define PT_LANE 0x01 /* LANE */ 42 | #define PT_LLC 0x02 /* LLC encapsulation */ 43 | #define PT_ILMI 0x05 /* ILMI */ 44 | #define PT_QSAAL 0x06 /* Q.SAAL */ 45 | -------------------------------------------------------------------------------- /daq-2.2.1/sfbpf/win32-stdinc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy) 3 | * Copyright (c) 2005 - 2009 CACE Technologies, Inc. Davis (California) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 3. Neither the name of the Politecnico di Torino nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef win32_stdinc_h 33 | #define win32_stdinc_h 34 | 35 | #define SIZEOF_CHAR 1 36 | #define SIZEOF_SHORT 2 37 | #define SIZEOF_INT 4 38 | #ifndef _MSC_EXTENSIONS 39 | #define SIZEOF_LONG_LONG 8 40 | #endif 41 | 42 | /* 43 | * Avoids a compiler warning in case this was already defined 44 | * (someone defined _WINSOCKAPI_ when including 'windows.h', in order 45 | * to prevent it from including 'winsock.h') 46 | */ 47 | #ifdef _WINSOCKAPI_ 48 | #undef _WINSOCKAPI_ 49 | #endif 50 | #include 51 | 52 | #include 53 | 54 | #include "bittypes.h" 55 | #include 56 | #include 57 | 58 | #ifndef __MINGW32__ 59 | #include "IP6_misc.h" 60 | #endif 61 | 62 | #define caddr_t char* 63 | 64 | #if _MSC_VER < 1500 65 | #define snprintf _snprintf 66 | #define vsnprintf _vsnprintf 67 | #define strdup _strdup 68 | #endif 69 | 70 | #define inline __inline 71 | 72 | #ifdef __MINGW32__ 73 | #include 74 | #else /*__MINGW32__*/ 75 | /* MSVC compiler */ 76 | #ifndef _UINTPTR_T_DEFINED 77 | #ifdef _WIN64 78 | typedef unsigned __int64 uintptr_t; 79 | #else 80 | typedef _W64 unsigned int uintptr_t; 81 | #endif 82 | #define _UINTPTR_T_DEFINED 83 | #endif 84 | 85 | #ifndef _INTPTR_T_DEFINED 86 | #ifdef _WIN64 87 | typedef __int64 intptr_t; 88 | #else 89 | typedef _W64 int intptr_t; 90 | #endif 91 | #define _INTPTR_T_DEFINED 92 | #endif 93 | 94 | #endif /*__MINGW32__*/ 95 | #endif /* win32_stdinc_h */ 96 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # DAQ 2.2.1 with dpdk16.07 multi-queue (RSS) support 2 | 3 | In this work we have added DPDK 16.07 multi-queue support for DAQ 2.2.1 to use 4 | with Snort 3.0 with multi threading support. 5 | 6 | ## Why this module? 7 | We needed a DAQ module that could use DPDK and exploit the Snort 3.0's multi thread capability. 8 | Furthermore, we needed full DPDK RSS support to fully avoid locking contention in the DAQ module. 9 | There is a good DPDK-DAQ for 2.9.8, however that was single threaded. http://seclists.org/snort/2016/q2/385 10 | Took that DAQ 2.0.6 module patch for Snort 2.9.8 and modified it to Snort 3.0 alpha 4 with multi-queue + 11 | DPDK RSS support. 12 | 13 | So here it is. 14 | 15 | ## How to setup 16 | 17 | 1. Download DPDK 16.07 and build it 18 | 19 | 2. Download or clone this DAQ 2.2.1 modified version: 20 | ```bash 21 | # cd daq-2.2.1 22 | # ./ configure --with-dpdk-includes=/x86_64-native-linuxapp-gcc/include --with-dpdk-libraries=/x86_64-native-linuxapp-gcc/lib 23 | # make install 24 | ``` 25 | 3. Download Snort 3.0 and build/install it. - currently, only alpha 4 is available. 26 | 27 | 28 | ## How to use 29 | 30 | Snort in inline mode (IPS) using 14 RSS queues and 14 cores on 1 interface pair: 31 | ```bash 32 | # taskset -c 0-13 snort --daq dpdk --daq-var dpdk_argc="-n4" -i "dpdk0:dpdk1" -Q -z 14 --daq-var dpdk_queues=14 33 | ``` 34 | 35 | Snort in inline mode (IPS) using 2 RSS queues and 14 cores on 2 interface pairs: 36 | ```bash 37 | # taskset -c 0-13 snort --daq dpdk --daq-var dpdk_argc="-n4" -i "dpdk0:dpdk1 dpdk2:dpdk3" -Q -z 14 --daq-var dpdk_queues=2 38 | ``` 39 | 40 | Snort in passive mode (IDS) using 14 RSS queues and 14 cores on 2 interfaces: 41 | ```bash 42 | # taskset -c 0-13 snort --daq dpdk --daq-var dpdk_argc="-n4" -i "dpdk0 dpdk1" -z 14 --daq-var dpdk_queues=14 43 | ``` 44 | 45 | Snort in passive mode (IDS) using 2 RSS queues and 4 cores on 1 interfaces: 46 | ```bash 47 | # taskset -c 0-13 snort --daq dpdk --daq-var dpdk_argc="-n4" -i "dpdk0" -z 4 --daq-var dpdk_queues=2 48 | ``` 49 | 50 | Note: taskset is used here to pin the cores used by Snort to run only on NUMA 0. This is done to avoid QPI 51 | utilization. Run the cores on the same NUMA node as the NIC is sitting on. 52 | 53 | a. Only one interface specifier is supported, but that may contain multiple interfaces and/or interface pairs. 54 | 55 | b. When specifying inline mode (-Q) the interface specification must only contain pairs, separated by ":" 56 | (dpdk0:dpdk1 dpdk2:dpdk3). 57 | 58 | c. Each pair in inline mode is bidirectional, thus both directions are handled by each thread. This way Snort 59 | keeps track of bi-directional protocols. 60 | 61 | d. If more threads than interfaces/pairs is specified, then the number of threads are equally distributes over 62 | the interfaces specified. If only 1 queue is specified, then each queue will get multiple threads that 63 | reads/transmits from/to it. In this case, locking contension must be expected to a certain degree. 64 | 65 | e: To avoid locking contention, you can make use of the multi-queue (RSS) feature on the HW. This is done with 66 | "--daq-var dpdk_queues=". Again the number of threads specified (-z option) is distributed 67 | over the number of specifed interfaces, over the number of queues. First queue 0 is assigned to a thread 68 | on all interfaces then queue 1 etc. until all queues has been assigned a thread. if more threads specified, 69 | then it starts over with queue 0 again. this means that each queue in a multiple queue system may have multiple 70 | threads (with some degree of lock contention). 71 | 72 | f. A good idea is to have the number of threads used equal an even number of interfaces times number of queues 73 | (i.e. 2 interfaces and 2 queues = 4 or 8 or 12... threads). However, typically the number of queues should 74 | be incresed with the number of threads, so that no locking contention occurs. 75 | 76 | g. When using RSS (multiple queues) the HW hashing algorithm used (at least specified) is as follows: 77 | ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP This means that the key is generated by IP address and UDP/TCP port 78 | numbers. 79 | 80 | h. Additionally an option "--daq-var debug" may be specified. This will print out various interesting information 81 | about the Rx and Tx trafic and this is done per thread, so that the load balancing may be visualized. 82 | 83 | ## Performance 84 | Xeon 2697 v3 - 14 core - Intel XL710 2 x 40G - bare metal testruns: 85 | Xena transmitter 68 byte packets Eth+IP+UDP with incrementing IP addresses. 86 | Packets decoded by Snort and passed. No explicit rules applied. 87 | Running Snort in inline mode. 88 | 89 | 16 Gbps thoroughput (20.8 Gbps wire speed) 29.5 Mpps - using 14 cores for Snort and 14 queues in a RSS setup. 90 | 91 | --------------------------------------------------------------------------------