GNU Radio 3.3.0 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2005,2007,2008 Free Software Foundation, Inc. 00004 * 00005 * This program is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation, either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #ifndef INCLUDED_USRP2_PKTFILTER_H 00020 #define INCLUDED_USRP2_PKTFILTER_H 00021 00022 struct sock_filter; 00023 00024 namespace usrp2 { 00025 00026 /* 00027 * \brief Compile programs for the Berkeley Packet Filter 00028 */ 00029 class pktfilter { 00030 public: 00031 00032 unsigned d_len; // # of instructions 00033 struct sock_filter *d_inst; // the instructions 00034 00035 pktfilter (); 00036 ~pktfilter (); 00037 00038 /*! 00039 * \brief Return a filter that harvests packets with the specified ethertype. 00040 * \param ethertype the ethertype we're looking for. 00041 */ 00042 static pktfilter *make_ethertype (unsigned short ethertype); 00043 00044 /*! 00045 * \brief Return a filter that harvests inbound packets with the specified ethertype. 00046 * \param ethertype the ethertype we're looking for 00047 * \param our_mac our MAC address so we can avoid pkts we sent 00048 */ 00049 static pktfilter *make_ethertype_inbound (unsigned short ethertype, 00050 const unsigned char *our_mac); 00051 00052 /*! 00053 * \brief Return a filter that harvests inbound packets with the specified ethertype 00054 * and source MAC address 00055 * \param ethertype the ethertype we're looking for 00056 * \param usrp_mac the source MAC address 00057 */ 00058 static pktfilter *make_ethertype_inbound_target (unsigned short ethertype, 00059 const unsigned char *usrp_mac); 00060 }; 00061 00062 } // namespace usrp2 00063 00064 #endif /* INCLUDED_USRP2_PKTFILTER_H */