libptpmgmt  1.4
libptpmgmt library that provides the functionality of linuxptp pmc
opt.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_OPT_H
13 #define __PTPMGMT_C_OPT_H
14 
15 #include "name.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
27 };
31  char short_name;
32  const char *long_name;
33  bool have_arg;
34  bool long_only;
35  const char *help_msg;
36  const char *arg_help;
37  const char *def_val;
38 };
39 
41 typedef struct ptpmgmt_opt_t *ptpmgmt_opt;
42 
44 typedef const struct ptpmgmt_opt_t *const_ptpmgmt_opt;
45 
50 struct ptpmgmt_opt_t {
52  void *_this;
59  void (*free)(ptpmgmt_opt opt);
64  void (*useDefOption)(ptpmgmt_opt opt);
72  bool (*insert)(ptpmgmt_opt opt, struct ptpmgmt_opt_option *addOpt);
78  const char *(*get_help)(ptpmgmt_opt opt);
84  const char *(*get_msg)(ptpmgmt_opt opt);
96  enum ptpmgmt_opt_loop_val(*parse_options)(ptpmgmt_opt opt, int argc,
97  char *argv[]);
104  bool (*have)(ptpmgmt_opt opt, char askOpt);
112  const char *(*val)(ptpmgmt_opt opt, char valOpt);
120  int (*val_i)(ptpmgmt_opt opt, char valOpt);
133  bool (*have_more)(ptpmgmt_opt opt);
140 };
141 
152 
153 #ifdef __cplusplus
154 }
155 #endif
156 
157 #endif /* __PTPMGMT_C_OPT_H */
struct ptpmgmt_opt_t * ptpmgmt_opt
Definition: opt.h:41
ptpmgmt_opt_loop_val
Definition: opt.h:22
@ PTPMGMT_OPT_HELP
Definition: opt.h:25
@ PTPMGMT_OPT_ERR
Definition: opt.h:23
@ PTPMGMT_OPT_DONE
Definition: opt.h:26
@ PTPMGMT_OPT_MSG
Definition: opt.h:24
ptpmgmt_opt ptpmgmt_opt_alloc_empty()
ptpmgmt_opt ptpmgmt_opt_alloc()
const struct ptpmgmt_opt_t * const_ptpmgmt_opt
Definition: opt.h:44
Define name space.
Definition: opt.h:29
const char * help_msg
Definition: opt.h:35
const char * def_val
Definition: opt.h:37
char short_name
Definition: opt.h:31
const char * arg_help
Definition: opt.h:36
const char * long_name
Definition: opt.h:32
bool long_only
Definition: opt.h:34
bool have_arg
Definition: opt.h:33
Definition: opt.h:50
void(* free)(ptpmgmt_opt opt)
Definition: opt.h:59
bool(* have)(ptpmgmt_opt opt, char askOpt)
Definition: opt.h:104
bool(* insert)(ptpmgmt_opt opt, struct ptpmgmt_opt_option *addOpt)
Definition: opt.h:72
int(* val_i)(ptpmgmt_opt opt, char valOpt)
Definition: opt.h:120
int(* process_next)(ptpmgmt_opt opt)
Definition: opt.h:139
void(* useDefOption)(ptpmgmt_opt opt)
Definition: opt.h:64
enum ptpmgmt_opt_loop_val(* parse_options)(ptpmgmt_opt opt, int argc, char *argv[])
Definition: opt.h:96
bool(* have_more)(ptpmgmt_opt opt)
Definition: opt.h:133
char(* get_net_transport)(ptpmgmt_opt opt)
Definition: opt.h:127