16 #ifndef __PTPMGMT_CFG_H
17 #define __PTPMGMT_CFG_H
23 __PTPMGMT_NAMESPACE_BEGIN
38 transportSpecific_val = val_base_val,
43 network_transport_val,
48 uds_address_val = str_base_val,
51 ptp_dst_mac_val = bin_base_val,
64 static const range_t ranges[];
66 std::string m_str_vals[bin_base_val - str_base_val];
68 Binary m_bin_vals[last_val - bin_base_val];
70 uint32_t m_vals[str_base_val - val_base_val];
73 bool m_set[last_val] = {
false };
77 bool set_val(
char *line);
91 std::map<std::string, ConfigSection> cfgSec;
92 ConfigSection *cfgGlobal;
93 void clear_sections();
95 uint32_t get_num(
int idx,
const std::string §ion)
const;
96 const std::string &get_str(
int idx,
const std::string §ion)
const;
97 const Binary &get_bin(
int idx,
const std::string §ion)
const;
98 bool is_global(
int idx,
const std::string §ion)
const;
135 uint8_t
udp_ttl(
const std::string §ion =
"")
const;
163 uint8_t
spp(
const std::string §ion =
"")
const;
177 bool haveSpp(
const std::string §ion =
"")
const;
184 const std::string &
uds_address(
const std::string §ion =
"")
const;
191 const std::string &
sa_file(
const std::string §ion =
"")
const;
245 std::map<uint32_t, key_t> m_keys;
249 bool set_val(
char *line);
250 void set(
long id) { m_own_id = (uint8_t)
id; m_keys.clear(); }
265 bool replace =
true);
288 size_t keys()
const {
return m_keys.size(); }
299 uint8_t
ownID()
const {
return m_own_id; }
304 Spp(uint8_t
id) : m_own_id(id) {}
305 Spp() : m_own_id(-1) {}
317 std::map<uint8_t, Spp> m_spps;
340 bool have(uint8_t
spp)
const {
return m_spps.count(
spp) > 0; }
358 __PTPMGMT_NAMESPACE_END
C interface to configuration class.
HMAC_t
Authentication key type.
Definition: cfg.h:213
@ HMAC_AES256
Definition: cfg.h:222
@ HMAC_SHA256
Definition: cfg.h:214
@ HMAC_AES128
Definition: cfg.h:218
Hold octets.
Definition: bin.h:28
Hold configuration parameters.
Definition: cfg.h:89
const std::string & uds_address(const std::string §ion="") const
uint8_t socket_priority(const std::string §ion="") const
bool read_cfg(const std::string &file)
uint8_t udp_ttl(const std::string §ion="") const
uint8_t transportSpecific(const std::string §ion="") const
uint8_t udp6_scope(const std::string §ion="") const
uint32_t active_key_id(const std::string §ion="") const
const Binary & ptp_dst_mac(const std::string §ion="") const
uint8_t network_transport(const std::string §ion="") const
bool haveSpp(const std::string §ion="") const
const std::string & sa_file(const std::string §ion="") const
uint8_t allow_unauth(const std::string §ion="") const
uint8_t spp(const std::string §ion="") const
const Binary & p2p_dst_mac(const std::string §ion="") const
uint8_t domainNumber(const std::string §ion="") const
authentication security association file
Definition: cfg.h:315
const Spp & spp(uint8_t spp) const
bool have(uint8_t spp, uint32_t key) const
Definition: cfg.h:347
bool have(uint8_t spp) const
Definition: cfg.h:340
bool read_sa(const std::string &file)
bool read_sa(const ConfigFile &cfg, const std::string §ion="")
authentication security parameters
Definition: cfg.h:232
Spp(uint8_t id)
Definition: cfg.h:304
bool addKey(uint32_t id, HMAC_t type, Binary &value, size_t digest, bool replace=true)
uint8_t ownID() const
Definition: cfg.h:299
const Binary & key(uint32_t key) const
bool have(uint32_t key) const
Definition: cfg.h:271
HMAC_t htype(uint32_t key) const
size_t mac_size(uint32_t key) const
size_t keys() const
Definition: cfg.h:288