libptpmgmt  1.3
libptpmgmt library that provides the functionality of linuxptp pmc
cfg.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-3.0-or-later
2  SPDX-FileCopyrightText: Copyright © 2023 Erez Geva <ErezGeva2@gmail.com> */
3 
12 #ifndef __PTPMGMT_C_CFG_H
13 #define __PTPMGMT_C_CFG_H
14 
15 #ifndef __cplusplus
16 #include <stdbool.h>
17 #endif /* __cplusplus */
18 #include "name.h"
19 
21 typedef struct ptpmgmt_cfg_t *ptpmgmt_cfg;
22 
24 typedef const struct ptpmgmt_cfg_t *const_ptpmgmt_cfg;
25 
27 typedef struct ptpmgmt_spp_t *ptpmgmt_spp;
28 
30 typedef const struct ptpmgmt_spp_t *const_ptpmgmt_spp;
31 
34 
36 typedef const struct ptpmgmt_safile_t *const_ptpmgmt_safile;
37 
42 struct ptpmgmt_cfg_t {
44  void *_this;
51  void (*free)(ptpmgmt_cfg cfg);
58  bool (*read_cfg)(ptpmgmt_cfg cfg, const char *file);
66  uint8_t (*transportSpecific)(const_ptpmgmt_cfg cfg, const char *section);
74  uint8_t (*domainNumber)(const_ptpmgmt_cfg cfg, const char *section);
82  uint8_t (*udp6_scope)(const_ptpmgmt_cfg cfg, const char *section);
90  uint8_t (*udp_ttl)(const_ptpmgmt_cfg cfg, const char *section);
98  uint8_t (*socket_priority)(const_ptpmgmt_cfg cfg, const char *section);
106  uint8_t (*network_transport)(const_ptpmgmt_cfg cfg, const char *section);
114  uint16_t (*active_key_id)(const_ptpmgmt_cfg cfg, const char *section);
122  uint8_t (*spp)(const_ptpmgmt_cfg cfg, const char *section);
130  uint8_t (*allow_unauth)(const_ptpmgmt_cfg cfg, const char *section);
138  bool (*haveSpp)(const_ptpmgmt_cfg cfg, const char *section);
146  const char *(*uds_address)(const_ptpmgmt_cfg cfg, const char *section);
154  const char *(*sa_file)(const_ptpmgmt_cfg cfg, const char *section);
163  const void *(*ptp_dst_mac)(const_ptpmgmt_cfg cfg, size_t *len,
164  const char *section);
173  const void *(*p2p_dst_mac)(const_ptpmgmt_cfg cfg, size_t *len,
174  const char *section);
175 };
176 
182 
198 };
199 
206  void *_this;
213  void (*free)(ptpmgmt_spp spp);
225  bool (*addKey)(ptpmgmt_spp spp, uint32_t id, enum PTPMGMT_HMAC_t type,
226  const void *value, size_t size, size_t digest, bool replace);
233  bool (*have)(const_ptpmgmt_spp spp, uint32_t key);
240  size_t (*mac_size)(const_ptpmgmt_spp spp, uint32_t key);
247  const void *(*key)(const_ptpmgmt_spp spp, uint32_t key);
254  size_t (*key_size)(const_ptpmgmt_spp spp, uint32_t key);
261  size_t (*keys)(const_ptpmgmt_spp spp);
268  enum PTPMGMT_HMAC_t (*htype)(const_ptpmgmt_spp spp, uint32_t key);
274  uint8_t (*ownID)(const_ptpmgmt_spp spp);
275 };
276 
288 
295  void *_this;
296  ptpmgmt_spp _all[UINT8_MAX];
303  void (*free)(ptpmgmt_safile sf);
310  bool (*read_sa)(ptpmgmt_safile sf, const char *file);
322  const char *section);
329  bool (*have)(const_ptpmgmt_safile sf, uint8_t spp);
337  bool (*have_key)(const_ptpmgmt_safile sf, uint8_t spp, uint32_t key);
345 };
346 
352 
353 #endif /* __PTPMGMT_C_CFG_H */
ptpmgmt_cfg ptpmgmt_cfg_alloc()
struct ptpmgmt_cfg_t * ptpmgmt_cfg
Definition: cfg.h:21
PTPMGMT_HMAC_t
Authentication key type.
Definition: cfg.h:188
@ PTPMGMT_HMAC_AES256
Definition: cfg.h:197
@ PTPMGMT_HMAC_AES128
Definition: cfg.h:193
@ PTPMGMT_HMAC_SHA256
Definition: cfg.h:189
struct ptpmgmt_spp_t * ptpmgmt_spp
Definition: cfg.h:27
ptpmgmt_spp ptpmgmt_spp_alloc_cp(const_ptpmgmt_spp spp)
const struct ptpmgmt_safile_t * const_ptpmgmt_safile
Definition: cfg.h:36
ptpmgmt_safile ptpmgmt_safile_alloc()
struct ptpmgmt_safile_t * ptpmgmt_safile
Definition: cfg.h:33
const struct ptpmgmt_cfg_t * const_ptpmgmt_cfg
Definition: cfg.h:24
const struct ptpmgmt_spp_t * const_ptpmgmt_spp
Definition: cfg.h:30
ptpmgmt_spp ptpmgmt_spp_alloc(uint8_t id)
Define name space.
Definition: cfg.h:42
uint8_t(* spp)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:122
uint8_t(* allow_unauth)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:130
uint8_t(* udp6_scope)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:82
uint8_t(* transportSpecific)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:66
bool(* read_cfg)(ptpmgmt_cfg cfg, const char *file)
Definition: cfg.h:58
uint16_t(* active_key_id)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:114
uint8_t(* udp_ttl)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:90
uint8_t(* socket_priority)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:98
uint8_t(* network_transport)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:106
void(* free)(ptpmgmt_cfg cfg)
Definition: cfg.h:51
uint8_t(* domainNumber)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:74
bool(* haveSpp)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:138
Definition: cfg.h:293
bool(* have_key)(const_ptpmgmt_safile sf, uint8_t spp, uint32_t key)
Definition: cfg.h:337
void(* free)(ptpmgmt_safile sf)
Definition: cfg.h:303
bool(* have)(const_ptpmgmt_safile sf, uint8_t spp)
Definition: cfg.h:329
bool(* read_sa)(ptpmgmt_safile sf, const char *file)
Definition: cfg.h:310
const_ptpmgmt_spp(* spp)(ptpmgmt_safile sf, uint8_t spp)
Definition: cfg.h:344
bool(* read_sa_cfg)(ptpmgmt_safile sf, const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:321
Definition: cfg.h:204
uint8_t(* ownID)(const_ptpmgmt_spp spp)
Definition: cfg.h:274
void(* free)(ptpmgmt_spp spp)
Definition: cfg.h:213
bool(* addKey)(ptpmgmt_spp spp, uint32_t id, enum PTPMGMT_HMAC_t type, const void *value, size_t size, size_t digest, bool replace)
Definition: cfg.h:225
bool(* have)(const_ptpmgmt_spp spp, uint32_t key)
Definition: cfg.h:233
size_t(* mac_size)(const_ptpmgmt_spp spp, uint32_t key)
Definition: cfg.h:240
const void *(* key)(const_ptpmgmt_spp spp, uint32_t key)
Definition: cfg.h:247
size_t(* key_size)(const_ptpmgmt_spp spp, uint32_t key)
Definition: cfg.h:254
size_t(* keys)(const_ptpmgmt_spp spp)
Definition: cfg.h:261
enum PTPMGMT_HMAC_t(* htype)(const_ptpmgmt_spp spp, uint32_t key)
Definition: cfg.h:268