NetSurf
Data Structures | Macros | Functions | Variables
sslcert.c File Reference

Implementation of RISC OS certificate verification UI. More...

#include <oslib/wimp.h>
#include "utils/log.h"
#include "utils/nsurl.h"
#include "netsurf/plotters.h"
#include "desktop/sslcert_viewer.h"
#include "riscos/dialog.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
#include "riscos/gui.h"
#include "riscos/toolbar.h"
#include "riscos/corewindow.h"
#include "riscos/sslcert.h"
Include dependency graph for sslcert.c:

Go to the source code of this file.

Data Structures

struct  ro_cert_window
 RISC OS certificate viewer context. More...
 

Macros

#define ICON_SSL_PANE   1
 
#define ICON_SSL_REJECT   3
 
#define ICON_SSL_ACCEPT   4
 

Functions

static void ro_gui_cert_release_window (struct ro_cert_window *certw)
 Handle closing of the RISC OS certificate verification dialog. More...
 
static void ro_gui_cert_accept (wimp_pointer *pointer)
 Handle acceptance of certificate via event callback. More...
 
static void ro_gui_cert_reject (wimp_pointer *pointer)
 Handle rejection of certificate via event callback. More...
 
static void ro_gui_cert_close_window (wimp_w w)
 Callback to handle the closure of the SSL dialogue by other means. More...
 
static nserror cert_attach_pane (wimp_w parent, wimp_w pane)
 Attach tree window as a pane to ssl window. More...
 
static nserror cert_draw (struct ro_corewindow *ro_cw, int originx, int originy, struct rect *r)
 Callback to draw on drawable area of ro certificate viewer window. More...
 
static nserror cert_key (struct ro_corewindow *ro_cw, uint32_t nskey)
 callback for keypress on ro certificate viewer window More...
 
static nserror cert_mouse (struct ro_corewindow *ro_cw, browser_mouse_state mouse_state, int x, int y)
 callback for mouse event on ro certificate viewer window More...
 
nserror gui_cert_verify (nsurl *url, const struct cert_chain *chain, nserror(*cb)(bool proceed, void *pw), void *cbpw)
 Prompt the user to verify a certificate with issuse. More...
 
void ro_gui_cert_initialise (void)
 Load and initialise the certificate window template. More...
 

Variables

static wimp_window * dialog_cert_template
 riscos dialog template for certificate viewer window. More...
 
static wimp_window * cert_tree_template
 riscos template for certificate tree pane. More...
 

Detailed Description

Implementation of RISC OS certificate verification UI.

Definition in file sslcert.c.

Macro Definition Documentation

◆ ICON_SSL_ACCEPT

#define ICON_SSL_ACCEPT   4

Definition at line 44 of file sslcert.c.

Referenced by gui_cert_verify().

◆ ICON_SSL_PANE

#define ICON_SSL_PANE   1

Definition at line 42 of file sslcert.c.

Referenced by cert_attach_pane().

◆ ICON_SSL_REJECT

#define ICON_SSL_REJECT   3

Definition at line 43 of file sslcert.c.

Referenced by gui_cert_verify().

Function Documentation

◆ cert_attach_pane()

static nserror cert_attach_pane ( wimp_w  parent,
wimp_w  pane 
)
static

Attach tree window as a pane to ssl window.

Nest the tree window inside the pane window. To do this, we:

  • Get the current pane extent,
  • Get the parent window position and the location of the pane- locating icon inside it,
  • Set the visible area of the pane to suit,
  • Check that the pane extents are OK for this visible area, and increase them if necessary,
  • Before finally opening the pane as a nested part of the parent.

Definition at line 158 of file sslcert.c.

References ICON_SSL_PANE, NSERROR_INIT_FAILED, NSERROR_OK, NSLOG, parent, PTR_WIMP_OPEN, ro_get_hscroll_height(), and ro_get_vscroll_width().

Referenced by gui_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cert_draw()

static nserror cert_draw ( struct ro_corewindow ro_cw,
int  originx,
int  originy,
struct rect r 
)
static

Callback to draw on drawable area of ro certificate viewer window.

Parameters
ro_cwThe riscos core window structure.
originxThe risc os plotter x origin.
originyThe risc os plotter y origin.
rThe rectangle of the window that needs updating.
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 248 of file sslcert.c.

References redraw_context::interactive, no_font_blending, NSERROR_OK, ro_plot_origin_x, ro_plot_origin_y, ro_plotters, ro_cert_window::ssl_data, and sslcert_viewer_redraw().

Referenced by gui_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cert_key()

static nserror cert_key ( struct ro_corewindow ro_cw,
uint32_t  nskey 
)
static

callback for keypress on ro certificate viewer window

Parameters
ro_cwThe ro core window structure.
nskeyThe netsurf key code.
Returns
NSERROR_OK if key processed, NSERROR_NOT_IMPLEMENTED if key not processed otherwise apropriate error code

Definition at line 278 of file sslcert.c.

References NSERROR_NOT_IMPLEMENTED, NSERROR_OK, ro_cert_window::ssl_data, and sslcert_viewer_keypress().

Referenced by gui_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cert_mouse()

static nserror cert_mouse ( struct ro_corewindow ro_cw,
browser_mouse_state  mouse_state,
int  x,
int  y 
)
static

callback for mouse event on ro certificate viewer window

Parameters
ro_cwThe ro core window structure.
mouse_statemouse state
xlocation of event
ylocation of event
Returns
NSERROR_OK on sucess otherwise apropriate error code.

Definition at line 300 of file sslcert.c.

References NSERROR_OK, ro_cert_window::ssl_data, and sslcert_viewer_mouse_action().

Referenced by gui_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_cert_verify()

nserror gui_cert_verify ( struct nsurl url,
const struct cert_chain chain,
nserror(*)(bool proceed, void *pw)  cb,
void *  cbpw 
)

◆ ro_gui_cert_accept()

static void ro_gui_cert_accept ( wimp_pointer *  pointer)
static

Handle acceptance of certificate via event callback.

Parameters
pointerThe wimp pointer event.

Definition at line 104 of file sslcert.c.

References ro_gui_cert_release_window(), ro_gui_dialog_close(), ro_gui_wimp_event_get_user_data(), ro_cert_window::ssl_data, sslcert_viewer_accept(), and ro_cert_window::wh.

Referenced by gui_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_cert_close_window()

static void ro_gui_cert_close_window ( wimp_w  w)
static

Callback to handle the closure of the SSL dialogue by other means.

Parameters
wThe window handle being closed.

Definition at line 136 of file sslcert.c.

References ro_gui_cert_release_window(), and ro_gui_wimp_event_get_user_data().

Referenced by gui_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_cert_initialise()

void ro_gui_cert_initialise ( void  )

Load and initialise the certificate window template.

Definition at line 401 of file sslcert.c.

References cert_tree_template, dialog_cert_template, and ro_gui_dialog_load_template().

Referenced by ro_gui_dialog_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_cert_reject()

static void ro_gui_cert_reject ( wimp_pointer *  pointer)
static

Handle rejection of certificate via event callback.

Parameters
pointerThe wimp pointer block.

Definition at line 120 of file sslcert.c.

References ro_gui_cert_release_window(), ro_gui_dialog_close(), ro_gui_wimp_event_get_user_data(), ro_cert_window::ssl_data, sslcert_viewer_reject(), and ro_cert_window::wh.

Referenced by gui_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_cert_release_window()

static void ro_gui_cert_release_window ( struct ro_cert_window certw)
static

Handle closing of the RISC OS certificate verification dialog.

Deleting wimp windows, freeing up the core window and ssl data block.

Parameters
certwThe context associated with the dialogue.

Definition at line 74 of file sslcert.c.

References ro_cert_window::core, NSLOG, ro_corewindow_fini(), ro_gui_wimp_event_finalise(), ro_cert_window::ssl_data, sslcert_viewer_fini(), ro_corewindow::wh, and ro_cert_window::wh.

Referenced by gui_cert_verify(), ro_gui_cert_accept(), ro_gui_cert_close_window(), and ro_gui_cert_reject().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cert_tree_template

wimp_window* cert_tree_template
static

riscos template for certificate tree pane.

Definition at line 64 of file sslcert.c.

Referenced by gui_cert_verify(), and ro_gui_cert_initialise().

◆ dialog_cert_template

wimp_window* dialog_cert_template
static

riscos dialog template for certificate viewer window.

Definition at line 61 of file sslcert.c.

Referenced by gui_cert_verify(), and ro_gui_cert_initialise().