Simplify argv handling.
[shishi.git] / src / data.h
blobf10b6a1e442e8799aea58b0d5a37490044aba38b
1 /* data.h global data structures for shishi application
2 * Copyright (C) 2002, 2003 Simon Josefsson
4 * This file is part of Shishi.
6 * Shishi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * Shishi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with Shishi; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef DATA_H
23 #define DATA_H
25 #if HAVE_CONFIG_H
26 #include "config.h"
27 #endif
29 #ifdef STDC_HEADERS
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <stdarg.h>
33 #include <ctype.h>
34 #endif
36 #if HAVE_UNISTD_H
37 #include <unistd.h>
38 #endif
40 #ifdef HAVE_NETDB_H
41 #include <netdb.h>
42 #endif
44 #if defined HAVE_DECL_H_ERRNO && !HAVE_DECL_H_ERRNO
45 /* extern int h_errno; */
46 #endif
48 #ifdef HAVE_PWD_H
49 #include <pwd.h>
50 #endif
52 #ifdef HAVE_SYS_TYPES_H
53 #include <sys/types.h>
54 #endif
56 #ifdef HAVE_SYS_SELECT_H
57 #include <sys/select.h>
58 #endif
60 #ifdef HAVE_SYS_SOCKET_H
61 #include <sys/socket.h>
62 #endif
64 #ifdef HAVE_SYS_IOCTL_H
65 #include <sys/ioctl.h>
66 #endif
68 #ifdef HAVE_ERRNO_H
69 #include <errno.h>
70 #endif
72 #if HAVE_INTTYPES_H
73 # include <inttypes.h>
74 #else
75 # if HAVE_STDINT_H
76 # include <stdint.h>
77 # endif
78 #endif
80 #if TIME_WITH_SYS_TIME
81 # include <sys/time.h>
82 # include <time.h>
83 #else
84 # if HAVE_SYS_TIME_H
85 # include <sys/time.h>
86 # else
87 # include <time.h>
88 # endif
89 #endif
91 #if HAVE_STRING_H
92 # if !STDC_HEADERS && HAVE_MEMORY_H
93 # include <memory.h>
94 # endif
95 # include <string.h>
96 #endif
97 #if HAVE_STRINGS_H
98 # include <strings.h>
99 #endif
101 #ifdef HAVE_SIGNAL_H
102 #include <signal.h>
103 #endif
105 #ifdef HAVE_NETINET_IN_H
106 #include <netinet/in.h>
107 #endif
108 #ifdef HAVE_NETINET_IN6_H
109 #include <netinet/in6.h>
110 #endif
112 #ifdef HAVE_LOCALE_H
113 #include <locale.h>
114 #endif
116 #include <gettext.h>
117 #include <shishi.h>
119 #define _(String) gettext (String)
120 #define gettext_noop(String) String
121 #define N_(String) gettext_noop (String)
123 /* Short and long parameter */
124 enum
126 COMMAND_AP = 1,
127 COMMAND_CRYPTO,
128 COMMAND_GET,
129 COMMAND_LIST,
130 COMMAND_DESTROY
133 /* Long parameters only */
134 enum
136 OPTION_GET_REQUEST = 300,
137 OPTION_GET_SENDRECV,
138 OPTION_GET_RESPONSE,
139 OPTION_GET_WRITE_AP_REQUEST_FILE,
140 OPTION_GET_WRITE_AUTHENTICATOR_FILE,
141 OPTION_GET_WRITE_REQUEST_FILE,
142 OPTION_GET_WRITE_RESPONSE_FILE,
143 OPTION_GET_READ_REQUEST_FILE,
144 OPTION_GET_READ_RESPONSE_FILE,
145 OPTION_GET_SERVER,
146 OPTION_GET_CLIENT,
147 OPTION_GET_PASSWORD,
148 OPTION_GET_CLIENT_NAME,
149 OPTION_GET_KEY_VALUE,
150 OPTION_GET_REALM,
151 OPTION_GET_SERVER_NAME,
152 OPTION_GET_TICKET_GRANTER,
153 OPTION_GET_FORCE_AS,
154 OPTION_GET_FORCE_TGS,
155 OPTION_AP_AUTHENTICATOR_READ_FILE,
156 OPTION_AP_AUTHENTICATOR_WRITE_FILE,
157 OPTION_AP_AUTHENTICATOR_DATA,
158 OPTION_AP_AUTHENTICATOR_READ_DATA_FILE,
159 OPTION_AP_REQUEST_READ_FILE,
160 OPTION_AP_REQUEST_WRITE_FILE,
161 OPTION_AP_REALM,
162 OPTION_AP_SERVER_NAME,
163 OPTION_CRYPTO_ENCRYPT,
164 OPTION_CRYPTO_DECRYPT,
165 OPTION_CRYPTO_ALGORITHM,
166 OPTION_CRYPTO_KEY_VERSION,
167 OPTION_CRYPTO_KEY_USAGE,
168 OPTION_CRYPTO_KEY_VALUE,
169 OPTION_CRYPTO_READ_KEY_FILE,
170 OPTION_CRYPTO_WRITE_KEY_FILE,
171 OPTION_CRYPTO_READ_DATA_FILE,
172 OPTION_CRYPTO_WRITE_DATA_FILE,
173 OPTION_CRYPTO_PASSWORD,
174 OPTION_CRYPTO_RANDOM,
175 OPTION_CRYPTO_PARAMETER,
176 OPTION_CRYPTO_REALM,
177 OPTION_CRYPTO_SALT,
178 OPTION_CRYPTO_CLIENT_NAME,
179 OPTION_CRYPTO_DEBUG,
180 OPTION_CRYPTO_GENERATE_KEY,
181 OPTION_LIST_SERVER_NAME,
182 OPTION_DESTROY_SERVER_NAME,
183 OPTION_VERBOSE_LIBRARY
186 #define TYPE_TEXT_NAME "text"
187 #define TYPE_DER_NAME "der"
188 #define TYPE_HEX_NAME "hex"
189 #define TYPE_BASE64_NAME "base64"
190 #define TYPE_BINARY_NAME "binary"
192 struct arguments
194 int silent, verbose, verbose_library;
195 char *etypes;
196 char *lib_options;
197 int command;
198 char *ticketfile;
199 char *ticketwritefile;
200 const char *realm;
201 char *systemcfgfile;
202 char *usercfgfile;
203 /* get and ap */
204 char *authenticatorwritefile;
205 int authenticatorwritetype;
206 char *apreqwritefile;
207 int apreqwritetype;
208 /* get */
209 const char *client;
210 const char *cname;
211 const char *sname;
212 char *tgtname;
213 int forceas_p;
214 int forcetgs_p;
215 int request_p;
216 int sendrecv_p;
217 int response_p;
218 char *kdcreqwritefile;
219 int kdcreqwritetype;
220 char *kdcreqreadfile;
221 int kdcreqreadtype;
222 char *kdcrepwritefile;
223 int kdcrepwritetype;
224 char *kdcrepreadfile;
225 int kdcrepreadtype;
226 /* ap */
227 char *apreqreadfile;
228 int apreqreadtype;
229 char *servername;
230 char *authenticatorreadfile;
231 int authenticatorreadtype;
232 char *authenticatordatareadfile;
233 int authenticatordatareadtype;
234 char *authenticatordata;
235 /* crypto */
236 int algorithm;
237 int encrypt_p;
238 int decrypt_p;
239 char *password;
240 char *salt;
241 char *parameter;
242 int random;
243 int kvno;
244 char *keyvalue;
245 int keyusage;
246 char *readkeyfile;
247 char *writekeyfile;
248 char *inputfile;
249 int inputtype;
250 char *outputfile;
251 int outputtype;
254 extern int ap (Shishi * handle, struct arguments arg);
256 extern int kdc (Shishi * handle, struct arguments arg);
258 extern int crypto (Shishi * handle, struct arguments arg);
260 #endif