UHD
003.004.001-23-stable
|
00001 // 00002 // Copyright 2010 Ettus Research LLC 00003 // 00004 // This program is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 // 00017 00018 #ifndef INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP 00019 #define INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP 00020 00021 #include <uhd/config.hpp> 00022 #include <boost/cstdint.hpp> 00023 #include <cstddef> //size_t 00024 00025 namespace uhd{ namespace transport{ 00026 00027 namespace vrt{ 00028 00030 static const size_t max_if_hdr_words32 = 7; //hdr+sid+cid+tsi+tsf 00031 00037 struct UHD_API if_packet_info_t{ 00038 //packet type (pack only supports data) 00039 enum packet_type_t { 00040 PACKET_TYPE_DATA = 0x0, 00041 PACKET_TYPE_EXTENSION = 0x1, 00042 PACKET_TYPE_CONTEXT = 0x2 00043 } packet_type; 00044 00045 //size fields 00046 size_t num_payload_words32; //required in pack, derived in unpack 00047 size_t num_payload_bytes; //required in pack, derived in unpack 00048 size_t num_header_words32; //derived in pack, derived in unpack 00049 size_t num_packet_words32; //derived in pack, required in unpack 00050 00051 //header fields 00052 size_t packet_count; 00053 bool sob, eob; 00054 00055 //optional fields 00056 bool has_sid; boost::uint32_t sid; 00057 bool has_cid; boost::uint64_t cid; 00058 bool has_tsi; boost::uint32_t tsi; 00059 bool has_tsf; boost::uint64_t tsf; 00060 bool has_tlr; boost::uint32_t tlr; 00061 }; 00062 00068 UHD_API void if_hdr_pack_be( 00069 boost::uint32_t *packet_buff, 00070 if_packet_info_t &if_packet_info 00071 ); 00072 00078 UHD_API void if_hdr_unpack_be( 00079 const boost::uint32_t *packet_buff, 00080 if_packet_info_t &if_packet_info 00081 ); 00082 00088 UHD_API void if_hdr_pack_le( 00089 boost::uint32_t *packet_buff, 00090 if_packet_info_t &if_packet_info 00091 ); 00092 00098 UHD_API void if_hdr_unpack_le( 00099 const boost::uint32_t *packet_buff, 00100 if_packet_info_t &if_packet_info 00101 ); 00102 00103 } //namespace vrt 00104 00105 }} //namespace 00106 00107 #endif /* INCLUDED_UHD_TRANSPORT_VRT_IF_PACKET_HPP */