root / host / include / uhd / device_addr.hpp @ eb7e709b
History | View | Annotate | Download (2.36 KB)
| 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_DEVICE_ADDR_HPP
|
| 19 |
#define INCLUDED_UHD_DEVICE_ADDR_HPP
|
| 20 |
|
| 21 |
#include <uhd/dict.hpp> |
| 22 |
#include <string> |
| 23 |
#include <iostream> |
| 24 |
#include <netinet/ether.h> |
| 25 |
#include <stdint.h> |
| 26 |
#include <vector> |
| 27 |
|
| 28 |
namespace uhd{
|
| 29 |
|
| 30 |
/*!
|
| 31 |
* Wrapper for an ethernet mac address.
|
| 32 |
* Provides conversion between string and binary formats.
|
| 33 |
*/
|
| 34 |
struct mac_addr_t{
|
| 35 |
struct ether_addr mac_addr;
|
| 36 |
mac_addr_t(const std::string &mac_addr_str = "00:00:00:00:00:00"); |
| 37 |
std::string to_string(void) const; |
| 38 |
}; |
| 39 |
|
| 40 |
/*!
|
| 41 |
* The device address args are just a mapping of key/value string pairs.
|
| 42 |
* When left empty, the discovery routine will try to find all usrps.
|
| 43 |
* The discovery can be narrowed down by specifying the transport type arguments.
|
| 44 |
*
|
| 45 |
* For example, to access a specific usrp2 one would specify the transport type
|
| 46 |
* ("type", "udp") and the transport args ("addr", "<resolvable_hostname_or_addr>").
|
| 47 |
*/
|
| 48 |
typedef dict<std::string, std::string> device_addr_t; |
| 49 |
typedef std::vector<device_addr_t> device_addrs_t;
|
| 50 |
|
| 51 |
/*!
|
| 52 |
* Function to turn a device address into a string.
|
| 53 |
* Just having the operator<< below should be sufficient.
|
| 54 |
* However, boost format seems to complain with the %
|
| 55 |
* and this is just easier because it works.
|
| 56 |
* \param device_addr a device address instance
|
| 57 |
* \return the string representation
|
| 58 |
*/
|
| 59 |
std::string device_addr_to_string(const device_addr_t &device_addr); |
| 60 |
|
| 61 |
} //namespace uhd
|
| 62 |
|
| 63 |
//ability to use types with stream operators
|
| 64 |
std::ostream& operator<<(std::ostream &, const uhd::device_addr_t &); |
| 65 |
std::ostream& operator<<(std::ostream &, const uhd::mac_addr_t &); |
| 66 |
|
| 67 |
#endif /* INCLUDED_UHD_DEVICE_ADDR_HPP */ |