Add.
[shishi.git] / lib / internal.h
blob0fd6dd55043f90c0ee07d01fe7d97a5f15f9db91
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_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
111 #ifdef HAVE_ARPA_INET_H
112 #include <arpa/inet.h>
113 #endif
115 #ifdef ENABLE_NLS
116 extern char *_shishi_gettext (const char *str);
117 #define _(String) _shishi_gettext (String)
118 #define gettext_noop(String) String
119 #define N_(String) gettext_noop (String)
120 #endif
122 #include "setenv.h"
123 #include "vasprintf.h"
124 #include "gettext.h"
125 #include "xalloc.h"
126 #include "shishi.h"
128 #define GENERALIZEDTIME_TIME_LEN 15
129 #define MAX_KEY_LEN 32
130 #define MAX_RANDOM_LEN 32
131 #define MAX_HASH_LEN 32
132 #define MAX_CKSUM_LEN 32
134 #define SHISHI_VERBOSE_CRYPTO (1<<1)
135 #define SHISHI_VERBOSE_ASN1 (1<<2)
136 #define SHISHI_VERBOSE_NOICE (1<<3)
138 #define KRBTGT "krbtgt"
139 #define PRINCIPAL_DELIMITER "/"
141 #define VERBOSEASN1(h) (h->verbose & SHISHI_VERBOSE_ASN1)
142 #define VERBOSECRYPTO(h) (h->verbose & SHISHI_VERBOSE_CRYPTO)
143 #define VERBOSENOICE(h) (h->verbose & SHISHI_VERBOSE_NOICE)
144 #define VERBOSES (SHISHI_VERBOSE_ASN1 | \
145 SHISHI_VERBOSE_CRYPTO | \
146 SHISHI_VERBOSE_NOICE)
147 #define VERBOSE(h) (h->verbose & ~VERBOSES)
149 #ifndef HOST_NAME_MAX
150 #define HOST_NAME_MAX BUFSIZ
151 #endif
153 struct Shishi_kdcinfo
155 char *name;
156 struct sockaddr sockaddress;
159 struct Shishi_realminfo
161 char *name;
162 struct Shishi_kdcinfo *kdcaddresses;
163 int nkdcaddresses;
166 struct Shishi
168 Shishi_asn1 asn1;
169 int verbose;
170 char *default_realm;
171 char *default_principal;
172 int kdctimeout;
173 int kdcretries;
174 int32_t *clientkdcetypes;
175 int nclientkdcetypes;
176 struct Shishi_realminfo *realminfos;
177 int nrealminfos;
178 char *kdc;
179 char error[1024];
180 char gztime_buf[40];
181 char *usercfgfile;
182 char *tktsdefaultfile;
183 char *hostkeysdefaultfile;
184 char *stringprocess;
185 Shishi_tkts *tkts;
188 #define BASE_DIR "/.shishi"
189 #define TICKET_FILE BASE_DIR "/tickets"
190 #define USERCFG_FILE BASE_DIR "/config"
193 _shishi_print_armored_data (Shishi * handle,
194 FILE * fh,
195 Shishi_asn1 asn1, char *asn1type, char *headers);
197 _shishi_save_data (Shishi * handle, FILE * fh, Shishi_asn1 asn1,
198 char *asn1type);
201 _shishi_authenticator_input (Shishi * handle,
202 FILE * fh, Shishi_asn1 * authenticator,
203 int type);
205 _shishi_apreq_input (Shishi * handle, FILE * fh, Shishi_asn1 * apreq,
206 int type);
207 int _shishi_aprep_input (Shishi * handle, FILE * fh, Shishi_asn1 * aprep,
208 int type);
209 int _shishi_kdcreq_input (Shishi * handle, FILE * fh, Shishi_asn1 * asreq,
210 int type);
211 int _shishi_kdcrep_input (Shishi * handle, FILE * fh, Shishi_asn1 * asrep,
212 int type);
213 int _shishi_krberror_input (Shishi * handle, FILE * fh,
214 Shishi_asn1 * krberror, int type);
215 int _shishi_encapreppart_input (Shishi * handle, FILE * fh,
216 Shishi_asn1 * encapreppart, int type);
217 int _shishi_safe_input (Shishi * handle, FILE * fh,
218 Shishi_asn1 * safe, int type);
220 Shishi_asn1 _shishi_asn1_read (void);
221 int _shishi_cipher_init (void);
224 shishi_asn1_integer2_field (Shishi * handle,
225 Shishi_asn1 node, unsigned long *i,
226 const char *field);
228 #if defined(WITH_DMALLOC) && WITH_DMALLOC
229 #include <dmalloc.h>
230 #endif
232 #endif /* _INTERNAL_H */