1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
/**
* @file
* Header for showing diff results.
*
* @author Jeremy A. Mowery jmowery@tresys.com
* @author Jason Tang jtang@tresys.com
* @author Brandon Whalen bwhalen@tresys.com
* @author Randy Wicks rwicks@tresys.com
*
* Copyright (C) 2004-2007 Tresys Technology, LLC
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef RESULTS_H
#define RESULTS_H
typedef enum results_sort
{
RESULTS_SORT_DEFAULT = 0,
RESULTS_SORT_SOURCE, RESULTS_SORT_TARGET,
RESULTS_SORT_CLASS, RESULTS_SORT_COND
} results_sort_e;
typedef enum results_sort_dir
{
RESULTS_SORT_DESCEND = -1, RESULTS_SORT_ASCEND = 1
} results_sort_dir_e;
#include "toplevel.h"
#include <gtk/gtk.h>
#include <poldiff/poldiff.h>
typedef struct results results_t;
/**
* Allocate and return a results object. This object is responsible
* for showing the results of a poldiff run, and all sorting of
* results.
*
* @param top Toplevel object to contain the results object.
*
* @return Results object, or NULL upon error. The caller is
* responsible for calling results_destroy() afterwards.
*/
results_t *results_create(toplevel_t * top);
/**
* Destroy the results object. This does nothing if the pointer is
* set to NULL.
*
* @param r Reference to a results object. Afterwards the pointer
* will be set to NULL.
*/
void results_destroy(results_t ** r);
/**
* Notify the results object that the policies have been changed.
*
* @param r Results object to notify.
* @param orig The (possibly newly loaded) original policy to diff.
* @param mod The (possibly newly loaded) modified policy to diff.
*/
void results_open_policies(results_t * r, apol_policy_t * orig, apol_policy_t * mod);
/**
* Clear all text from the results object. This should be done prior
* to running a new diff.
*
* @param r Results object to clear.
*/
void results_clear(results_t * r);
/**
* Update the results display to match the most recent poldiff run.
*
* @param r Results object to update.
*/
void results_update(results_t * r);
/**
* Called whenever the user switches to the results page. This
* function is responsible for setting up its menus and other widgets.
*
* @param r Results object to update.
*/
void results_switch_to_page(results_t * r);
/**
* Sort the currently visible result buffer (which hopefully is the TE
* rules diff) using the given criteria.
*
* @param r Results object to sort.
* @param field Component of a rule to sort against.
* @param direction Direction of sort, either RESULTS_SORT_ASCEND or
* RESULTS_SORT_DESCEND.
*/
void results_sort(results_t * r, results_sort_e field, results_sort_dir_e direction);
/**
* Get the currently showing text view for the results object.
*
* @param r Results object containing text view.
*
* @return Currently visible text view.
*/
GtkTextView *results_get_text_view(results_t * r);
#endif
|