1 /*-
2  * Copyright (c) 2009 The NetBSD Foundation, Inc.
3  * All rights reserved.
4  *
5  * This code is derived from software contributed to The NetBSD Foundation
6  * by Alistair Crooks (agc@NetBSD.org)
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 /*
30  * Copyright (c) 2005-2008 Nominet UK (www.nic.uk)
31  * All rights reserved.
32  * Contributors: Ben Laurie, Rachel Willmer. The Contributors have asserted
33  * their moral rights under the UK Copyright Design and Patents Act 1988 to
34  * be recorded as the authors of this copyright work.
35  *
36  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
37  * use this file except in compliance with the License.
38  *
39  * You may obtain a copy of the License at
40  *     http://www.apache.org/licenses/LICENSE-2.0
41  *
42  * Unless required by applicable law or agreed to in writing, software
43  * distributed under the License is distributed on an "AS IS" BASIS,
44  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
45  *
46  * See the License for the specific language governing permissions and
47  * limitations under the License.
48  */
49 
50 /** \file
51  */
52 
53 #ifndef PACKET_SHOW_H_
54 #define PACKET_SHOW_H_
55 
56 #include "packet.h"
57 
58 /** pgp_list_t
59  */
60 typedef struct {
61 	unsigned    size;	/* num of array slots allocated */
62 	unsigned    used;	/* num of array slots currently used */
63 	char          **strings;
64 } pgp_list_t;
65 
66 /** pgp_text_t
67  */
68 typedef struct {
69 	pgp_list_t	known;
70 	pgp_list_t   	unknown;
71 } pgp_text_t;
72 
73 /** pgp_bit_map_t
74  */
75 typedef struct {
76 	uint8_t		mask;
77 	const char     *string;
78 } pgp_bit_map_t;
79 
80 void pgp_text_init(pgp_text_t *);
81 void pgp_text_free(pgp_text_t *);
82 
83 const char *pgp_show_packet_tag(pgp_content_enum);
84 const char *pgp_show_ss_type(pgp_content_enum);
85 
86 const char *pgp_show_sig_type(pgp_sig_type_t);
87 const char *pgp_show_pka(pgp_pubkey_alg_t);
88 
89 pgp_text_t *pgp_showall_ss_zpref(const pgp_data_t *);
90 const char *pgp_show_ss_zpref(uint8_t);
91 
92 pgp_text_t *pgp_showall_ss_hashpref(const pgp_data_t *);
93 const char *pgp_show_hash_alg(uint8_t);
94 const char *pgp_show_symm_alg(uint8_t);
95 
96 pgp_text_t *pgp_showall_ss_skapref(const pgp_data_t *);
97 const char *pgp_show_ss_skapref(uint8_t);
98 
99 const char *pgp_show_ss_rr_code(pgp_ss_rr_code_t);
100 
101 pgp_text_t *pgp_showall_ss_features(pgp_data_t);
102 
103 pgp_text_t *pgp_showall_ss_key_flags(const pgp_data_t *);
104 const char *pgp_show_ss_key_flag(uint8_t, pgp_bit_map_t *);
105 
106 pgp_text_t *pgp_show_keyserv_prefs(const pgp_data_t *);
107 const char *pgp_show_keyserv_pref(uint8_t, pgp_bit_map_t *);
108 
109 pgp_text_t *pgp_showall_notation(pgp_ss_notation_t);
110 
111 #endif /* PACKET_SHOW_H_ */
112