USRP Hardware Driver and USRP Manual  Version: 003.008.002-0-ge9d11b35
UHD and USRP Manual
vrt_if_packet.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2013 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 num_vrl_words32 = 3;
31 
33  static const size_t max_if_hdr_words32 = 7; //hdr+sid+cid+tsi+tsf
34 
41  {
42  if_packet_info_t(void);
43 
44  //link layer type - always set for pack and unpack
46  {
47  LINK_TYPE_NONE = 0x0,
48  LINK_TYPE_CHDR = 0x1,
49  LINK_TYPE_VRLP = 0x2,
50  } link_type;
51 
52  //packet type
54  {
55  PACKET_TYPE_DATA = 0x0,
56  PACKET_TYPE_IF_EXT = 0x1,
57  PACKET_TYPE_CONTEXT = 0x2, //extension context: has_sid = true
58  } packet_type;
59 
60  //size fields
61  size_t num_payload_words32; //required in pack, derived in unpack
62  size_t num_payload_bytes; //required in pack, derived in unpack
63  size_t num_header_words32; //derived in pack, derived in unpack
64  size_t num_packet_words32; //derived in pack, required in unpack
65 
66  //header fields
67  size_t packet_count;
68  bool sob, eob;
69 
70  //optional fields
71  bool has_sid; boost::uint32_t sid;
72  bool has_cid; boost::uint64_t cid;
73  bool has_tsi; boost::uint32_t tsi;
74  bool has_tsf; boost::uint64_t tsf;
75  bool has_tlr; boost::uint32_t tlr;
76  };
77 
84  boost::uint32_t *packet_buff,
85  if_packet_info_t &if_packet_info
86  );
87 
94  const boost::uint32_t *packet_buff,
95  if_packet_info_t &if_packet_info
96  );
97 
103  UHD_API void if_hdr_pack_le(
104  boost::uint32_t *packet_buff,
105  if_packet_info_t &if_packet_info
106  );
107 
114  const boost::uint32_t *packet_buff,
115  if_packet_info_t &if_packet_info
116  );
117 
119  link_type(LINK_TYPE_NONE),
120  packet_type(PACKET_TYPE_DATA),
121  num_payload_words32(0),
122  num_payload_bytes(0),
123  num_header_words32(0),
124  num_packet_words32(0),
125  packet_count(0),
126  sob(false), eob(false),
127  has_sid(false), sid(0),
128  has_cid(false), cid(0),
129  has_tsi(false), tsi(0),
130  has_tsf(false), tsf(0),
131  has_tlr(false), tlr(0)
132  {}
133 
134 } //namespace vrt
135 
136 }} //namespace
137 
138 #endif /* INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP */
boost::uint32_t tlr
Definition: vrt_if_packet.hpp:75
Definition: vrt_if_packet.hpp:40
boost::uint32_t tsi
Definition: vrt_if_packet.hpp:73
size_t num_packet_words32
Definition: vrt_if_packet.hpp:64
UHD_API void if_hdr_pack_le(boost::uint32_t *packet_buff, if_packet_info_t &if_packet_info)
if_packet_info_t(void)
Definition: vrt_if_packet.hpp:118
packet_type_t
Definition: vrt_if_packet.hpp:53
boost::uint64_t tsf
Definition: vrt_if_packet.hpp:74
bool has_cid
Definition: vrt_if_packet.hpp:72
link_type_t
Definition: vrt_if_packet.hpp:45
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:79
Definition: convert.hpp:28
#define UHD_INLINE
Definition: config.hpp:69
size_t num_payload_bytes
Definition: vrt_if_packet.hpp:62
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:67
size_t num_payload_words32
Definition: vrt_if_packet.hpp:61
size_t num_header_words32
Definition: vrt_if_packet.hpp:63
bool sob
Definition: vrt_if_packet.hpp:68
boost::uint32_t sid
Definition: vrt_if_packet.hpp:71