blob: 8ea5803219258ed97ded3f91c8673688662a9e3d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
//
// Copyright 2010 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef INCLUDED_UHD_DEVICE_ADDR_HPP
#define INCLUDED_UHD_DEVICE_ADDR_HPP
#include <uhd/dict.hpp>
#include <string>
#include <iostream>
#include <netinet/ether.h>
#include <stdint.h>
#include <vector>
namespace uhd{
/*!
* Wrapper for an ethernet mac address.
* Provides conversion between string and binary formats.
*/
struct mac_addr_t{
struct ether_addr mac_addr;
mac_addr_t(const std::string &mac_addr_str = "00:00:00:00:00:00");
std::string to_string(void) const;
};
/*!
* The device address args are just a mapping of key/value string pairs.
* When left empty, the discovery routine will try to find all usrps.
* The discovery can be narrowed down by specifying the transport type arguments.
*
* For example, to access a specific usrp2 one would specify the transport type
* ("type", "udp") and the transport args ("addr", "<resolvable_hostname_or_addr>").
*/
typedef dict<std::string, std::string> device_addr_t;
typedef std::vector<device_addr_t> device_addrs_t;
/*!
* Function to turn a device address into a string.
* Just having the operator<< below should be sufficient.
* However, boost format seems to complain with the %
* and this is just easier because it works.
* \param device_addr a device address instance
* \return the string representation
*/
std::string device_addr_to_string(const device_addr_t &device_addr);
} //namespace uhd
//ability to use types with stream operators
std::ostream& operator<<(std::ostream &, const uhd::device_addr_t &);
std::ostream& operator<<(std::ostream &, const uhd::mac_addr_t &);
#endif /* INCLUDED_UHD_DEVICE_ADDR_HPP */
|