NetSurf
sslcert_viewer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2009 Paul Blokus <paul_pl@users.sourceforge.net>
3  * Copyright 2013 Michael Drake <tlsa@netsurf-browser.org>
4  *
5  * This file is part of NetSurf, http://www.netsurf-browser.org/
6  *
7  * NetSurf 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; version 2 of the License.
10  *
11  * NetSurf 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.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 /**
21  * \file
22  * SSL Certificate verification UI interface
23  */
24 
25 #ifndef NETSURF_DESKTOP_SSLCERT_VIEWER_H
26 #define NETSURF_DESKTOP_SSLCERT_VIEWER_H
27 
28 #include "netsurf/mouse.h"
29 
31 struct redraw_context;
33 struct rect;
34 struct nsurl;
35 struct cert_chain;
36 
37 /**
38  * Create ssl certificate viewer session data.
39  *
40  * \param url Address of the page we're inspecting certificates of
41  * \param cb Low level cache callback
42  * \param cbpw Low level cache private data
43  * \param chain The SSL certificate chain
44  * \param ssl_d Updated to SSL certificate session data
45  * \return NSERROR_OK on success, appropriate error otherwise
46  *
47  * Pass the session data to sslcert_viewer_init.
48  * sslcert_viewer_fini destroys the session data.
49  */
51  struct nsurl *url,
52  nserror (*cb)(bool proceed, void *pw),
53  void *cbpw,
54  const struct cert_chain *chain,
55  struct sslcert_session_data **ssl_d);
56 
57 
58 /**
59  * Initialise a ssl certificate viewer from session data.
60  *
61  * This iterates through the certificates, building a treeview.
62  *
63  * \param cw_t Callback table for cert viewer's core_window
64  * \param core_window_handle The core_window in which the cert viewer is shown
65  * \param ssl_d SSL certificate session data
66  * \return NSERROR_OK on success, appropriate error otherwise
67  */
69  void *core_window_handle,
70  struct sslcert_session_data *ssl_d);
71 
72 
73 /**
74  * Finalise a ssl certificate viewer.
75  *
76  * This destroys the certificate treeview and the certificate viewer module's
77  * session data.
78  *
79  * \param ssl_d SSL certificate session data
80  * \return NSERROR_OK on success, appropriate error otherwise
81  */
83 
84 
85 /**
86  * Reject a certificate chain.
87  *
88  * \param ssl_d SSL certificate session data
89  * \return NSERROR_OK on success, appropriate error otherwise
90  */
92 
93 
94 /**
95  * Accept a certificate chain.
96  *
97  * \param ssl_d SSL certificate session data
98  * \return NSERROR_OK on success, appropriate error otherwise
99  */
101 
102 
103 /**
104  * Redraw the ssl certificate viewer.
105  *
106  * \param ssl_d SSL certificate session data
107  * \param x X coordinate to render treeview at
108  * \param y Y coordinate to render treeview at
109  * \param clip Current clip rectangle (wrt tree origin)
110  * \param ctx Current redraw context
111  */
113  int x, int y, struct rect *clip,
114  const struct redraw_context *ctx);
115 
116 
117 /**
118  * Handles all kinds of mouse action
119  *
120  * \param ssl_d SSL certificate session data
121  * \param mouse The current mouse state
122  * \param x X coordinate
123  * \param y Y coordinate
124  */
126  browser_mouse_state mouse, int x, int y);
127 
128 
129 /**
130  * Key press handling.
131  *
132  * \param ssl_d SSL certificate session data
133  * \param key The ucs4 character codepoint
134  * \return true if the keypress is dealt with, false otherwise.
135  */
136 bool sslcert_viewer_keypress(struct sslcert_session_data *ssl_d, uint32_t key);
137 
138 #endif
nserror sslcert_viewer_create_session_data(struct nsurl *url, nserror(*cb)(bool proceed, void *pw), void *cbpw, const struct cert_chain *chain, struct sslcert_session_data **ssl_d)
Create ssl certificate viewer session data.
browser_mouse_state
Mouse state.
Definition: mouse.h:43
Core mouse and pointer states.
nserror
Enumeration of error codes.
Definition: errors.h:29
nserror sslcert_viewer_init(struct core_window_callback_table *cw_t, void *core_window_handle, struct sslcert_session_data *ssl_d)
Initialise a ssl certificate viewer from session data.
void sslcert_viewer_redraw(struct sslcert_session_data *ssl_d, int x, int y, struct rect *clip, const struct redraw_context *ctx)
Redraw the ssl certificate viewer.
void sslcert_viewer_mouse_action(struct sslcert_session_data *ssl_d, browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
X509 certificate chain.
Definition: ssl_certs.h:59
Redraw context.
Definition: plotters.h:51
nserror sslcert_viewer_fini(struct sslcert_session_data *ssl_d)
Finalise a ssl certificate viewer.
nserror sslcert_viewer_accept(struct sslcert_session_data *ssl_d)
Accept a certificate chain.
static struct core_window_callback_table cw_t
Declare Core Window Callbacks:
Definition: treeview.c:534
Rectangle coordinates.
Definition: types.h:40
Callbacks to achieve various core window functionality.
Definition: core_window.h:51
bool sslcert_viewer_keypress(struct sslcert_session_data *ssl_d, uint32_t key)
Key press handling.
ssl certificate verification context.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Definition: plot.c:357
nserror sslcert_viewer_reject(struct sslcert_session_data *ssl_d)
Reject a certificate chain.
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31