libptpmgmt  1.4
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 #ifdef __cplusplus
16 extern "C" {
17 #else
18 #include <stdbool.h>
19 #endif
20 #include "name.h"
21 
23 typedef struct ptpmgmt_cfg_t *ptpmgmt_cfg;
24 
26 typedef const struct ptpmgmt_cfg_t *const_ptpmgmt_cfg;
27 
29 typedef struct ptpmgmt_spp_t *ptpmgmt_spp;
30 
32 typedef const struct ptpmgmt_spp_t *const_ptpmgmt_spp;
33 
36 
38 typedef const struct ptpmgmt_safile_t *const_ptpmgmt_safile;
39 
44 struct ptpmgmt_cfg_t {
46  void *_this;
53  void (*free)(ptpmgmt_cfg cfg);
60  bool (*read_cfg)(ptpmgmt_cfg cfg, const char *file);
68  uint8_t (*transportSpecific)(const_ptpmgmt_cfg cfg, const char *section);
76  uint8_t (*domainNumber)(const_ptpmgmt_cfg cfg, const char *section);
84  uint8_t (*udp6_scope)(const_ptpmgmt_cfg cfg, const char *section);
92  uint8_t (*udp_ttl)(const_ptpmgmt_cfg cfg, const char *section);
100  uint8_t (*socket_priority)(const_ptpmgmt_cfg cfg, const char *section);
108  uint8_t (*network_transport)(const_ptpmgmt_cfg cfg, const char *section);
116  uint16_t (*active_key_id)(const_ptpmgmt_cfg cfg, const char *section);
124  uint8_t (*spp)(const_ptpmgmt_cfg cfg, const char *section);
132  uint8_t (*allow_unauth)(const_ptpmgmt_cfg cfg, const char *section);
140  bool (*haveSpp)(const_ptpmgmt_cfg cfg, const char *section);
148  const char *(*uds_address)(const_ptpmgmt_cfg cfg, const char *section);
156  const char *(*sa_file)(const_ptpmgmt_cfg cfg, const char *section);
165  const void *(*ptp_dst_mac)(const_ptpmgmt_cfg cfg, size_t *len,
166  const char *section);
175  const void *(*p2p_dst_mac)(const_ptpmgmt_cfg cfg, size_t *len,
176  const char *section);
177 };
178 
184 
200 };
201 
208  void *_this;
215  void (*free)(ptpmgmt_spp spp);
227  bool (*addKey)(ptpmgmt_spp spp, uint32_t id, enum PTPMGMT_HMAC_t type,
228  const void *value, size_t size, size_t digest, bool replace);
235  bool (*have)(const_ptpmgmt_spp spp, uint32_t key);
242  size_t (*mac_size)(const_ptpmgmt_spp spp, uint32_t key);
249  const void *(*key)(const_ptpmgmt_spp spp, uint32_t key);
256  size_t (*key_size)(const_ptpmgmt_spp spp, uint32_t key);
263  size_t (*keys)(const_ptpmgmt_spp spp);
270  enum PTPMGMT_HMAC_t (*htype)(const_ptpmgmt_spp spp, uint32_t key);
276  uint8_t (*ownID)(const_ptpmgmt_spp spp);
277 };
278 
290 
297  void *_this;
298  ptpmgmt_spp _all[UINT8_MAX];
305  void (*free)(ptpmgmt_safile sf);
312  bool (*read_sa)(ptpmgmt_safile sf, const char *file);
324  const char *section);
331  bool (*have)(const_ptpmgmt_safile sf, uint8_t spp);
339  bool (*have_key)(const_ptpmgmt_safile sf, uint8_t spp, uint32_t key);
347 };
348 
354 
355 #ifdef __cplusplus
356 }
357 #endif
358 
359 #endif /* __PTPMGMT_C_CFG_H */
ptpmgmt_cfg ptpmgmt_cfg_alloc()
struct ptpmgmt_cfg_t * ptpmgmt_cfg
Definition: cfg.h:23
PTPMGMT_HMAC_t
Authentication key type.
Definition: cfg.h:190
@ PTPMGMT_HMAC_AES256
Definition: cfg.h:199
@ PTPMGMT_HMAC_AES128
Definition: cfg.h:195
@ PTPMGMT_HMAC_SHA256
Definition: cfg.h:191
struct ptpmgmt_spp_t * ptpmgmt_spp
Definition: cfg.h:29
ptpmgmt_spp ptpmgmt_spp_alloc_cp(const_ptpmgmt_spp spp)
const struct ptpmgmt_safile_t * const_ptpmgmt_safile
Definition: cfg.h:38
ptpmgmt_safile ptpmgmt_safile_alloc()
struct ptpmgmt_safile_t * ptpmgmt_safile
Definition: cfg.h:35
const struct ptpmgmt_cfg_t * const_ptpmgmt_cfg
Definition: cfg.h:26
const struct ptpmgmt_spp_t * const_ptpmgmt_spp
Definition: cfg.h:32
ptpmgmt_spp ptpmgmt_spp_alloc(uint8_t id)
Define name space.
Definition: cfg.h:44
uint8_t(* spp)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:124
uint8_t(* allow_unauth)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:132
uint8_t(* udp6_scope)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:84
uint8_t(* transportSpecific)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:68
bool(* read_cfg)(ptpmgmt_cfg cfg, const char *file)
Definition: cfg.h:60
uint16_t(* active_key_id)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:116
uint8_t(* udp_ttl)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:92
uint8_t(* socket_priority)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:100
uint8_t(* network_transport)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:108
void(* free)(ptpmgmt_cfg cfg)
Definition: cfg.h:53
uint8_t(* domainNumber)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:76
bool(* haveSpp)(const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:140
Definition: cfg.h:295
bool(* have_key)(const_ptpmgmt_safile sf, uint8_t spp, uint32_t key)
Definition: cfg.h:339
void(* free)(ptpmgmt_safile sf)
Definition: cfg.h:305
bool(* have)(const_ptpmgmt_safile sf, uint8_t spp)
Definition: cfg.h:331
bool(* read_sa)(ptpmgmt_safile sf, const char *file)
Definition: cfg.h:312
const_ptpmgmt_spp(* spp)(ptpmgmt_safile sf, uint8_t spp)
Definition: cfg.h:346
bool(* read_sa_cfg)(ptpmgmt_safile sf, const_ptpmgmt_cfg cfg, const char *section)
Definition: cfg.h:323
Definition: cfg.h:206
uint8_t(* ownID)(const_ptpmgmt_spp spp)
Definition: cfg.h:276
void(* free)(ptpmgmt_spp spp)
Definition: cfg.h:215
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:227
bool(* have)(const_ptpmgmt_spp spp, uint32_t key)
Definition: cfg.h:235
size_t(* mac_size)(const_ptpmgmt_spp spp, uint32_t key)
Definition: cfg.h:242
const void *(* key)(const_ptpmgmt_spp spp, uint32_t key)
Definition: cfg.h:249
size_t(* key_size)(const_ptpmgmt_spp spp, uint32_t key)
Definition: cfg.h:256
size_t(* keys)(const_ptpmgmt_spp spp)
Definition: cfg.h:263
enum PTPMGMT_HMAC_t(* htype)(const_ptpmgmt_spp spp, uint32_t key)
Definition: cfg.h:270