Git init
[external/xmlsec1.git] / apps / cmdline.h
1 /** 
2  * XMLSec library
3  * 
4  * Command line parsing routines
5  *
6  * See Copyright for the status of this software.
7  * 
8  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey@aleksey.com>
9  */
10 #ifndef __XMLSEC_APPS_CMDLINE_H__
11 #define __XMLSEC_APPS_CMDLINE_H__    
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif /* __cplusplus */ 
16
17 #include <time.h>
18
19 typedef struct _xmlSecAppCmdLineParam           xmlSecAppCmdLineParam,
20                                                 *xmlSecAppCmdLineParamPtr;
21 typedef struct _xmlSecAppCmdLineValue           xmlSecAppCmdLineValue,
22                                                 *xmlSecAppCmdLineValuePtr;
23 typedef unsigned int                            xmlSecAppCmdLineParamTopic;
24
25 #define xmlSecAppCmdLineParamFlagNone                   0x0000
26 #define xmlSecAppCmdLineParamFlagParamNameValue         0x0001
27 #define xmlSecAppCmdLineParamFlagMultipleValues         0x0002
28
29 typedef enum {
30     xmlSecAppCmdLineParamTypeFlag,
31     xmlSecAppCmdLineParamTypeString,
32     xmlSecAppCmdLineParamTypeStringList,
33     xmlSecAppCmdLineParamTypeNumber,
34     xmlSecAppCmdLineParamTypeTime
35 } xmlSecAppCmdLineParamType;
36
37 struct _xmlSecAppCmdLineParam {
38     xmlSecAppCmdLineParamTopic  topics;
39     const char*                 fullName;
40     const char*                 shortName;
41     const char*                 help;
42     xmlSecAppCmdLineParamType   type;
43     int                         flags;
44     xmlSecAppCmdLineValuePtr    value;
45 };
46
47 int             xmlSecAppCmdLineParamIsSet              (xmlSecAppCmdLineParamPtr param);
48 const char*     xmlSecAppCmdLineParamGetString          (xmlSecAppCmdLineParamPtr param);
49 const char*     xmlSecAppCmdLineParamGetStringList      (xmlSecAppCmdLineParamPtr param);
50 int             xmlSecAppCmdLineParamGetInt             (xmlSecAppCmdLineParamPtr param,
51                                                          int def);
52 time_t          xmlSecAppCmdLineParamGetTime            (xmlSecAppCmdLineParamPtr param,
53                                                          time_t def);
54
55 int             xmlSecAppCmdLineParamsListParse         (xmlSecAppCmdLineParamPtr* params,
56                                                          xmlSecAppCmdLineParamTopic topcis,
57                                                          const char** argv,
58                                                          int argc,
59                                                          int pos);
60 void            xmlSecAppCmdLineParamsListClean         (xmlSecAppCmdLineParamPtr* params);
61 void            xmlSecAppCmdLineParamsListPrint         (xmlSecAppCmdLineParamPtr* params,
62                                                          xmlSecAppCmdLineParamTopic topic,
63                                                          FILE* output);
64
65 struct _xmlSecAppCmdLineValue {
66     xmlSecAppCmdLineParamPtr    param;
67     int                         pos;
68     const char*                 paramNameValue;
69     const char*                 strValue;
70     const char*                 strListValue;
71     int                         intValue;
72     time_t                      timeValue;
73     xmlSecAppCmdLineValuePtr    next;
74 };
75
76
77 xmlSecAppCmdLineValuePtr xmlSecAppCmdLineValueCreate    (xmlSecAppCmdLineParamPtr param,
78                                                          int pos);
79 void                     xmlSecAppCmdLineValueDestroy   (xmlSecAppCmdLineValuePtr value);                                                                
80
81
82 #ifdef __cplusplus
83 }
84 #endif /* __cplusplus */
85
86 #endif /* __XMLSEC_APPS_CMDLINE_H__ */
87
88
89