UHD 003.004.003-0-unknown

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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
37 struct UHD_API if_packet_info_t{
38 //packet type (pack only supports data)
39 enum packet_type_t {
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
68 UHD_API void if_hdr_pack_be(
69 boost::uint32_t *packet_buff,
70 if_packet_info_t &if_packet_info
71 );
72
78 UHD_API void if_hdr_unpack_be(
79 const boost::uint32_t *packet_buff,
80 if_packet_info_t &if_packet_info
81 );
82
88 UHD_API void if_hdr_pack_le(
89 boost::uint32_t *packet_buff,
90 if_packet_info_t &if_packet_info
91 );
92
98 UHD_API void if_hdr_unpack_le(
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 */