]> git.proxmox.com Git - ceph.git/blob - ceph/src/common/pick_address.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / common / pick_address.h
1 #ifndef CEPH_PICK_ADDRESS_H
2 #define CEPH_PICK_ADDRESS_H
3
4 #include "common/config.h"
5
6 class CephContext;
7
8
9 #define CEPH_PICK_ADDRESS_PUBLIC 0x01
10 #define CEPH_PICK_ADDRESS_CLUSTER 0x02
11
12 /*
13 Pick addresses based on subnets if needed.
14
15 If an address is not explicitly given, and a list of subnets is
16 given, find an assigned IP address in the subnets and set that.
17
18 cluster_addr is set based on cluster_network, public_addr is set
19 based on public_network.
20
21 cluster_network and public_network are a list of ip/prefix pairs.
22
23 All IP addresses assigned to all local network interfaces are
24 potential matches.
25
26 If multiple IP addresses match the subnet, one of them will be
27 picked, effectively randomly.
28
29 This function will exit on error.
30 */
31 void pick_addresses(CephContext *cct, int needs);
32
33 /**
34 * check for a locally configured address
35 *
36 * check if any of the listed addresses is configured on the local host.
37 *
38 * @param cct context
39 * @param ls list of addresses
40 * @param match [out] pointer to match, if an item in @a ls is found configured locally.
41 */
42 bool have_local_addr(CephContext *cct, const list<entity_addr_t>& ls, entity_addr_t *match);
43
44 #endif