UHD  003.005.004-0-ga219f16c
vrt_if_packet.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010 Ettus Research LLC
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP
19 #define INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP
20 
21 #include <uhd/config.hpp>
22 #include <boost/cstdint.hpp>
23 #include <cstddef> //size_t
24 
25 namespace uhd{ namespace transport{
26 
27 namespace vrt{
28 
30  static const size_t max_if_hdr_words32 = 7; //hdr+sid+cid+tsi+tsf
31 
38  //packet type (pack only supports data)
40  PACKET_TYPE_DATA = 0x0,
41  PACKET_TYPE_EXTENSION = 0x1,
42  PACKET_TYPE_CONTEXT = 0x2
43  } packet_type;
44 
45  //size fields
46  size_t num_payload_words32; //required in pack, derived in unpack
47  size_t num_payload_bytes; //required in pack, derived in unpack
48  size_t num_header_words32; //derived in pack, derived in unpack
49  size_t num_packet_words32; //derived in pack, required in unpack
50 
51  //header fields
52  size_t packet_count;
53  bool sob, eob;
54 
55  //optional fields
56  bool has_sid; boost::uint32_t sid;
57  bool has_cid; boost::uint64_t cid;
58  bool has_tsi; boost::uint32_t tsi;
59  bool has_tsf; boost::uint64_t tsf;
60  bool has_tlr; boost::uint32_t tlr;
61  };
62 
69  boost::uint32_t *packet_buff,
70  if_packet_info_t &if_packet_info
71  );
72 
79  const boost::uint32_t *packet_buff,
80  if_packet_info_t &if_packet_info
81  );
82 
89  boost::uint32_t *packet_buff,
90  if_packet_info_t &if_packet_info
91  );
92 
99  const boost::uint32_t *packet_buff,
100  if_packet_info_t &if_packet_info
101  );
102 
103 } //namespace vrt
104 
105 }} //namespace
106 
107 #endif /* INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP */
boost::uint32_t tlr
Definition: vrt_if_packet.hpp:60
Definition: vrt_if_packet.hpp:37
boost::uint32_t tsi
Definition: vrt_if_packet.hpp:58
size_t num_packet_words32
Definition: vrt_if_packet.hpp:49
UHD_API void if_hdr_pack_le(boost::uint32_t *packet_buff, if_packet_info_t &if_packet_info)
packet_type_t
Definition: vrt_if_packet.hpp:39
boost::uint64_t tsf
Definition: vrt_if_packet.hpp:59
bool has_cid
Definition: vrt_if_packet.hpp:57
UHD_API void if_hdr_unpack_be(const boost::uint32_t *packet_buff, if_packet_info_t &if_packet_info)
UHD_API void if_hdr_pack_be(boost::uint32_t *packet_buff, if_packet_info_t &if_packet_info)
#define UHD_API
Definition: config.hpp:76
Definition: convert.hpp:28
size_t num_payload_bytes
Definition: vrt_if_packet.hpp:47
UHD_API void if_hdr_unpack_le(const boost::uint32_t *packet_buff, if_packet_info_t &if_packet_info)
size_t packet_count
Definition: vrt_if_packet.hpp:52
size_t num_payload_words32
Definition: vrt_if_packet.hpp:46
size_t num_header_words32
Definition: vrt_if_packet.hpp:48
bool sob
Definition: vrt_if_packet.hpp:53
boost::uint32_t sid
Definition: vrt_if_packet.hpp:56