ad3407813499bb59d17cb2083dec7ed2dd284281
[debian/gnuradio] / vrt / include / vrt / rx_packet_handler.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2009 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio 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 along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 #ifndef INCLUDED_VRT_RX_PACKET_HANDLER_H
22 #define INCLUDED_VRT_RX_PACKET_HANDLER_H
23
24 #include <vrt/expanded_header.h>
25 #include <stddef.h>
26
27 namespace vrt {
28
29   /*!
30    * \brief Abstract function object called to handle received VRT packets.
31    *
32    * An object derived from this class is passed to vrt_rx_udp::rx_packets
33    * to process the received packets.
34    */
35   class rx_packet_handler {
36   public:
37     virtual ~rx_packet_handler();
38
39     /*!
40      * \param payload points to the first 32-bit word of the payload field.
41      * \param n32_bit_words is the number of 32-bit words in the payload field.
42      * \param hdr is the expanded version of the mandatory and optional header fields (& trailer).
43      *
44      * \p payload points to the raw payload section of the packet received off
45      * the wire. The data is network-endian (aka big-endian) 32-bit integers.
46      *
47      * This is the general purpose, low level interface and relies on other
48      * functions to handle all required endian-swapping and format conversion
49      * of the payload.  \sa FIXME.
50      *
51      * \returns true if the object wants to be called again with new data;
52      * false if no additional data is wanted.
53      */
54     virtual bool operator()(const uint32_t *payload,
55                             size_t n32_bit_words,
56                             const expanded_header *hdr);
57   };
58
59 };  // vrt
60
61
62 #endif /* INCLUDED_VRT_RX_PACKET_HANDLER_H */