Generated.
[shishi.git] / lib / internal.h
blob61052d642eb2bc7732d1ce086ba6b858f40ba56d
1 /* internal.h internal header file for shishi
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 _INTERNAL_H
23 #define _INTERNAL_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_SYS_STAT_H
69 #include <sys/stat.h>
70 #endif
72 #ifdef HAVE_FCNTL_H
73 #include <fcntl.h>
74 #endif
76 #ifdef HAVE_ERRNO_H
77 #include <errno.h>
78 #endif
80 #if HAVE_INTTYPES_H
81 # include <inttypes.h>
82 #else
83 # if HAVE_STDINT_H
84 # include <stdint.h>
85 # endif
86 #endif
88 #if TIME_WITH_SYS_TIME
89 # include <sys/time.h>
90 # include <time.h>
91 #else
92 # if HAVE_SYS_TIME_H
93 # include <sys/time.h>
94 # else
95 # include <time.h>
96 # endif
97 #endif
99 #if HAVE_STRING_H
100 # if !STDC_HEADERS && HAVE_MEMORY_H
101 # include <memory.h>
102 # endif
103 # include <string.h>
104 #endif
105 #if HAVE_STRINGS_H
106 # include <strings.h>
107 #endif
109 #ifdef HAVE_SIGNAL_H
110 #include <signal.h>
111 #endif
113 #ifdef HAVE_NETINET_IN_H
114 #include <netinet/in.h>
115 #endif
116 #ifdef HAVE_NETINET_IN6_H
117 #include <netinet/in6.h>
118 #endif
119 #ifdef HAVE_ARPA_INET_H
120 #include <arpa/inet.h>
121 #endif
123 #ifdef HAVE_ARPA_NAMESER_H
124 #include <arpa/nameser.h>
125 #endif
126 #ifdef HAVE_RESOLV_H
127 #include <resolv.h>
128 #endif
130 #include "setenv.h"
131 #include "vasprintf.h"
132 #include "gettext.h"
133 #include "xalloc.h"
134 #include "shishi.h"
136 #define _(String) dgettext (PACKAGE, String)
137 #define gettext_noop(String) String
138 #define N_(String) gettext_noop (String)
140 #define GENERALIZEDTIME_TIME_LEN 15
141 #define MAX_KEY_LEN 32
142 #define MAX_RANDOM_LEN 32
143 #define MAX_HASH_LEN 32
144 #define MAX_CKSUM_LEN 32
146 #define SHISHI_VERBOSE_CRYPTO (1<<1)
147 #define SHISHI_VERBOSE_ASN1 (1<<2)
148 #define SHISHI_VERBOSE_NOICE (1<<3)
150 #define KRBTGT "krbtgt"
151 #define PRINCIPAL_DELIMITER "/"
153 #define VERBOSEASN1(h) (h->verbose & SHISHI_VERBOSE_ASN1)
154 #define VERBOSECRYPTO(h) (h->verbose & SHISHI_VERBOSE_CRYPTO)
155 #define VERBOSENOICE(h) (h->verbose & SHISHI_VERBOSE_NOICE)
156 #define VERBOSES (SHISHI_VERBOSE_ASN1 | \
157 SHISHI_VERBOSE_CRYPTO | \
158 SHISHI_VERBOSE_NOICE)
159 #define VERBOSE(h) (h->verbose & ~VERBOSES)
161 #ifndef HOST_NAME_MAX
162 #define HOST_NAME_MAX BUFSIZ
163 #endif
165 struct Shishi_kdcinfo
167 char *name;
168 struct sockaddr sockaddress;
171 struct Shishi_realminfo
173 char *name;
174 struct Shishi_kdcinfo *kdcaddresses;
175 int nkdcaddresses;
178 struct Shishi
180 Shishi_asn1 asn1;
181 int verbose;
182 char *default_realm;
183 char *default_principal;
184 int kdctimeout;
185 int kdcretries;
186 int32_t *clientkdcetypes;
187 int nclientkdcetypes;
188 struct Shishi_realminfo *realminfos;
189 int nrealminfos;
190 char *kdc;
191 char error[1024];
192 char gztime_buf[40];
193 char *userdirectory;
194 char *usercfgfile;
195 char *tktsdefaultfile;
196 char *hostkeysdefaultfile;
197 char *stringprocess;
198 Shishi_tkts *tkts;
201 #define BASE_DIR "/.shishi"
202 #define TICKET_FILE BASE_DIR "/tickets"
203 #define USERCFG_FILE BASE_DIR "/shishi.conf"
206 _shishi_print_armored_data (Shishi * handle,
207 FILE * fh,
208 Shishi_asn1 asn1, char *asn1type, char *headers);
210 _shishi_save_data (Shishi * handle, FILE * fh, Shishi_asn1 asn1,
211 char *asn1type);
214 _shishi_authenticator_input (Shishi * handle,
215 FILE * fh, Shishi_asn1 * authenticator,
216 int type);
218 _shishi_apreq_input (Shishi * handle, FILE * fh, Shishi_asn1 * apreq,
219 int type);
220 int _shishi_aprep_input (Shishi * handle, FILE * fh, Shishi_asn1 * aprep,
221 int type);
222 int _shishi_kdcreq_input (Shishi * handle, FILE * fh, Shishi_asn1 * asreq,
223 int type);
224 int _shishi_kdcrep_input (Shishi * handle, FILE * fh, Shishi_asn1 * asrep,
225 int type);
226 int _shishi_krberror_input (Shishi * handle, FILE * fh,
227 Shishi_asn1 * krberror, int type);
228 int _shishi_encapreppart_input (Shishi * handle, FILE * fh,
229 Shishi_asn1 * encapreppart, int type);
230 int _shishi_safe_input (Shishi * handle, FILE * fh,
231 Shishi_asn1 * safe, int type);
233 Shishi_asn1 _shishi_asn1_read (void);
234 int _shishi_cipher_init (void);
237 shishi_asn1_integer2_field (Shishi * handle,
238 Shishi_asn1 node, unsigned long *i,
239 const char *field);
241 #if defined(WITH_DMALLOC) && WITH_DMALLOC
242 #include <dmalloc.h>
243 #endif
245 /* older systems might not have these */
246 #ifndef T_SRV
247 # define T_SRV (33)
248 #endif
250 typedef struct dnshost_st
252 struct dnshost_st *next;
254 unsigned int type;
255 unsigned int class;
256 unsigned int ttl;
258 void *rr;
259 } *dnshost_t;
261 typedef struct dns_srv_st
263 unsigned int priority;
264 unsigned int weight;
265 unsigned int port;
266 unsigned int rweight;
268 char name[256];
269 } *dns_srv_t;
271 dnshost_t _shishi_resolv (const char *zone, unsigned int type);
272 void _shishi_resolv_free (dnshost_t dns);
274 #endif /* _INTERNAL_H */