OpenDNSSEC-enforcer  1.4.1
parser.h
Go to the documentation of this file.
1 /*
2  * $Id: parser.h 731 2009-05-18 08:24:19Z sion $
3  *
4  * Copyright (c) 2008-2009 Nominet UK. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
29 #ifndef KSM_PARSER_H
30 #define KSM_PARSER_H
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*+
37  * parser.h - Parser Include File
38  *
39  * Description:
40  * Defines the functions and structures used by the parser.
41 -*/
42 
43 #include "commands.h"
44 
45 /* Command Option Descriptor */
46 
47 typedef struct {
48  char option; /* The single letter option found */
49  char* string; /* Value of the option, or NULL if no value found */
50  /* It is up to the caller to free this string */
51  long value; /* Value of the string as long value */
52  int valid; /* 1 if the "string"->"value" conversion succeeded */
53 } par_option;
54 
55 typedef par_option **PAR_OPTLIST; /* PAR_OPTLIST is the basic type now */
56 
57 /* Function definitions */
58 
59 void ParAdd(par_option*** optlist, char option, const char* string);
60 void ParFree(par_option*** optlist);
61 
62 int ParPresent(par_option** optlist, char option);
63 int ParValid(par_option** optlist, char option);
64 const char* ParString(par_option** optlist, char option);
65 long ParValue(par_option** optlist, char option);
66 
67 int ParCommand(int argc, char** argv, CMD_DESCRIPTOR* cmdlist);
68 
69 #ifdef __cplusplus
70 };
71 #endif
72 
73 #endif /* KSM_PARSER_H */