Sync with TP.
[gnutls.git] / lib / debug.c
blob58e0bcda8ecb42d03ec357e292f22cbd3eb31bad
1 /*
2 * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
3 * Free Software Foundation, Inc.
5 * Author: Nikos Mavrogiannopoulos
7 * This file is part of GNUTLS.
9 * The GNUTLS library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 * USA
26 #include "gnutls_int.h"
27 #include "gnutls_errors.h"
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include "debug.h"
32 const char *
33 _gnutls_packet2str (content_type_t packet)
35 switch (packet)
37 case GNUTLS_CHANGE_CIPHER_SPEC:
38 return "Change Cipher Spec";
39 case GNUTLS_ALERT:
40 return "Alert";
41 case GNUTLS_HANDSHAKE:
42 return "Handshake";
43 case GNUTLS_APPLICATION_DATA:
44 return "Application Data";
45 case GNUTLS_INNER_APPLICATION:
46 return "Inner Application";
48 default:
49 return "Unknown Packet";
53 const char *
54 _gnutls_handshake2str (gnutls_handshake_description_t handshake)
57 switch (handshake)
59 case GNUTLS_HANDSHAKE_HELLO_REQUEST:
60 return "HELLO REQUEST";
61 break;
62 case GNUTLS_HANDSHAKE_CLIENT_HELLO:
63 return "CLIENT HELLO";
64 break;
65 case GNUTLS_HANDSHAKE_SERVER_HELLO:
66 return "SERVER HELLO";
67 break;
68 case GNUTLS_HANDSHAKE_CERTIFICATE_PKT:
69 return "CERTIFICATE";
70 break;
71 case GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE:
72 return "SERVER KEY EXCHANGE";
73 break;
74 case GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST:
75 return "CERTIFICATE REQUEST";
76 break;
77 case GNUTLS_HANDSHAKE_SERVER_HELLO_DONE:
78 return "SERVER HELLO DONE";
79 break;
80 case GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY:
81 return "CERTIFICATE VERIFY";
82 break;
83 case GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE:
84 return "CLIENT KEY EXCHANGE";
85 break;
86 case GNUTLS_HANDSHAKE_FINISHED:
87 return "FINISHED";
88 break;
89 case GNUTLS_HANDSHAKE_SUPPLEMENTAL:
90 return "SUPPLEMENTAL";
91 break;
92 case GNUTLS_HANDSHAKE_NEW_SESSION_TICKET:
93 return "NEW SESSION TICKET";
94 break;
95 default:
96 return "Unknown Handshake packet";