libptpmgmt  1.4
libptpmgmt library that provides the functionality of linuxptp pmc
init.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-3.0-or-later
2  SPDX-FileCopyrightText: Copyright © 2021 Erez Geva <ErezGeva2@gmail.com> */
3 
12 #ifndef __PTPMGMT_INIT_H
13 #define __PTPMGMT_INIT_H
14 
15 #ifdef __cplusplus
16 #include "msg.h"
17 #include "opt.h"
18 #include "sock.h"
19 
20 __PTPMGMT_NAMESPACE_BEGIN
21 
26 class Init
27 {
28  private:
29  ConfigFile m_cfg;
30  SaFile m_sa;
31  Message m_msg;
32  std::unique_ptr<SockBase> m_sk;
33  char m_net_select = 0;
34  bool m_use_uds = false;
35  uint8_t m_allow_unauth = 0;
36 
37  public:
41  void close();
42 
49  int process(const Options &opt);
50 
55  const ConfigFile &cfg() const { return m_cfg; }
56 
61  const SaFile &sa() const { return m_sa; }
62 
67  Message &msg() { return m_msg; }
68 
74  SockBase *sk() { return m_sk.get(); }
75 
84  char getNetSelect() { return m_net_select; }
85 
90  bool use_uds() const { return m_use_uds; }
91 
96  uint8_t allow_unauth() const { return m_allow_unauth; }
97 
101  __PTPMGMT_DEPRECATED_DEC(int proccess(const Options &opt));
103 };
104 
105 __PTPMGMT_NAMESPACE_END
106 #else /* __cplusplus */
107 #include "c/init.h"
108 #endif /* __cplusplus */
109 
110 #endif /* __PTPMGMT_INIT_H */
C interface to initialize a pmc application class.
Create and parse PTP management messages.
C interface to command line options parsing class.
C interface to sockets classes.
Hold configuration parameters.
Definition: cfg.h:89
Definition: init.h:27
uint8_t allow_unauth() const
Definition: init.h:96
int process(const Options &opt)
const ConfigFile & cfg() const
Definition: init.h:55
const SaFile & sa() const
Definition: init.h:61
void close()
bool use_uds() const
Definition: init.h:90
char getNetSelect()
Definition: init.h:84
SockBase * sk()
Definition: init.h:74
Message & msg()
Definition: init.h:67
Handle PTP management message.
Definition: msg.h:58
Hold and process options.
Definition: opt.h:47
authentication security association file
Definition: cfg.h:315
Base class for all sockets.
Definition: sock.h:44