Imported Upstream version 3.0.21
[platform/upstream/gnutls.git] / src / common.h
1 /*
2  * Copyright (C) 2000-2012 Free Software Foundation, Inc.
3  * Author: Nikos Mavrogiannopoulos
4  *
5  * This file is part of GnuTLS.
6  *
7  * GnuTLS is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * GnuTLS is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #define SERVER "127.0.0.1"
22
23 #include <config.h>
24 #include <gnutls/gnutls.h>
25
26 #include <sys/socket.h>
27 #include <netdb.h>
28 #include <unistd.h>
29 #ifndef _WIN32
30 # include <netinet/in.h>
31 #endif
32
33 #include <signal.h>
34 #ifdef _WIN32
35 #include <io.h>
36 #include <winbase.h>
37 #endif
38
39 #ifndef __attribute__
40 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
41 #define __attribute__(Spec)     /* empty */
42 #endif
43 #endif
44
45 /* the number of elements in the priority structures.
46  */
47 #define PRI_MAX 16
48
49 extern const char str_unknown[];
50
51 int print_info (gnutls_session_t state, int print_cert);
52 void print_cert_info (gnutls_session_t, int flag, int print_cert);
53 void print_cert_info_compact (gnutls_session_t session);
54
55 void print_list (const char* priorities, int verbose);
56 int cert_verify (gnutls_session_t session, const char* hostname);
57
58 const char *raw_to_string (const unsigned char *raw, size_t raw_size);
59 void pkcs11_common (void);
60 int check_command(gnutls_session_t session, const char* str);